First Commit of new way of building the Platform
This commit is contained in:
1 parent
e48cf0dae5
commit
40e60b42cc
4616 files changed
+713402
No files matched your search
+116
@@ -0,0 +1,116 @@
|
||||
/*!
|
||||
* assertion-error
|
||||
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Return a function that will copy properties from
|
||||
* one object to another excluding any originally
|
||||
* listed. Returned function will create a new `{}`.
|
||||
*
|
||||
* @param {String} excluded properties ...
|
||||
* @return {Function}
|
||||
*/
|
||||
|
||||
function exclude () {
|
||||
var excludes = [].slice.call(arguments);
|
||||
|
||||
function excludeProps (res, obj) {
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
if (!~excludes.indexOf(key)) res[key] = obj[key];
|
||||
});
|
||||
}
|
||||
|
||||
return function extendExclude () {
|
||||
var args = [].slice.call(arguments)
|
||||
, i = 0
|
||||
, res = {};
|
||||
|
||||
for (; i < args.length; i++) {
|
||||
excludeProps(res, args[i]);
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
};
|
||||
|
||||
/*!
|
||||
* Primary Exports
|
||||
*/
|
||||
|
||||
module.exports = AssertionError;
|
||||
|
||||
/**
|
||||
* ### AssertionError
|
||||
*
|
||||
* An extension of the JavaScript `Error` constructor for
|
||||
* assertion and validation scenarios.
|
||||
*
|
||||
* @param {String} message
|
||||
* @param {Object} properties to include (optional)
|
||||
* @param {callee} start stack function (optional)
|
||||
*/
|
||||
|
||||
function AssertionError (message, _props, ssf) {
|
||||
var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
|
||||
, props = extend(_props || {});
|
||||
|
||||
// default values
|
||||
this.message = message || 'Unspecified AssertionError';
|
||||
this.showDiff = false;
|
||||
|
||||
// copy from properties
|
||||
for (var key in props) {
|
||||
this[key] = props[key];
|
||||
}
|
||||
|
||||
// capture stack trace
|
||||
ssf = ssf || AssertionError;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, ssf);
|
||||
} else {
|
||||
try {
|
||||
throw new Error();
|
||||
} catch(e) {
|
||||
this.stack = e.stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Inherit from Error.prototype
|
||||
*/
|
||||
|
||||
AssertionError.prototype = Object.create(Error.prototype);
|
||||
|
||||
/*!
|
||||
* Statically set name
|
||||
*/
|
||||
|
||||
AssertionError.prototype.name = 'AssertionError';
|
||||
|
||||
/*!
|
||||
* Ensure correct constructor
|
||||
*/
|
||||
|
||||
AssertionError.prototype.constructor = AssertionError;
|
||||
|
||||
/**
|
||||
* Allow errors to be converted to JSON for static transfer.
|
||||
*
|
||||
* @param {Boolean} include stack (default: `true`)
|
||||
* @return {Object} object that can be `JSON.stringify`
|
||||
*/
|
||||
|
||||
AssertionError.prototype.toJSON = function (stack) {
|
||||
var extend = exclude('constructor', 'toJSON', 'stack')
|
||||
, props = extend({ name: this.name }, this);
|
||||
|
||||
// include stack if exists and not turned off
|
||||
if (false !== stack && this.stack) {
|
||||
props.stack = this.stack;
|
||||
}
|
||||
|
||||
return props;
|
||||
};
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"assertion-error@1.1.0",
|
||||
"C:\\Users\\Luis\\source\\repos\\AAMasters\\WebServer"
|
||||
]
|
||||
],
|
||||
"_from": "assertion-error@1.1.0",
|
||||
"_id": "assertion-error@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||
"_location": "/assertion-error",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "assertion-error@1.1.0",
|
||||
"name": "assertion-error",
|
||||
"escapedName": "assertion-error",
|
||||
"rawSpec": "1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/chai"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\WebServer",
|
||||
"author": {
|
||||
"name": "Jake Luer",
|
||||
"email": "jake@qualiancy.com",
|
||||
"url": "http://qualiancy.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chaijs/assertion-error/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification.",
|
||||
"devDependencies": {
|
||||
"component": "*",
|
||||
"typescript": "^2.6.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/chaijs/assertion-error#readme",
|
||||
"keywords": [
|
||||
"test",
|
||||
"assertion",
|
||||
"assertion-error"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index",
|
||||
"name": "assertion-error",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/chaijs/assertion-error.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"types": "./index.d.ts",
|
||||
"version": "1.1.0"
|
||||
}
|
||||
Reference in new issue
Block a user