protoblast
Advanced tools
Comparing version 0.3.10 to 0.4.0
@@ -0,1 +1,14 @@ | ||
## 0.4.0 (2017-10-12) | ||
* Added `Pledge` class, which is a type of `Promise` | ||
* `Function.parallel` now returns a `Pledge` instance | ||
* `Function.create` now also sets the wrapper arguments, so the `length` property matches | ||
* Added `Informer.setAfterMethod(filter, key, method)`, which is a method that will prevent execution until it has seen the given filter (string or object) | ||
* Fix crash when using recursive objects on `Object.alike(a, b)` | ||
* `Array#flatten` will now preserve the perceived order | ||
* Add support for other HTTP methods in `Request` | ||
* Add experimental `Informer.setCacheMethod` function | ||
* Remove the `#toSource()` methods | ||
* `Benchmark` should now calculate correct overhead cost on node 8.x | ||
## 0.3.10 (2017-09-07) | ||
@@ -2,0 +15,0 @@ |
@@ -130,56 +130,2 @@ module.exports = function BlastArray(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the array. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @param {Boolean|Number} tab If indent should be used | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('Array', 'toSource', function toSource(tab) { | ||
var result, | ||
passtab, | ||
i; | ||
if (tab === true) { | ||
tab = 1; | ||
} | ||
if (tab > 0) { | ||
passtab = tab + 1; | ||
} else { | ||
passtab = tab; | ||
tab = 0; | ||
} | ||
for (i = 0; i < this.length; i++) { | ||
if (!result) { | ||
result = '['; | ||
} else { | ||
result += ','; | ||
} | ||
if (tab) { | ||
result += '\n' + Blast.Bound.String.multiply('\t', tab); | ||
} | ||
result += Blast.uneval(this[i], passtab); | ||
} | ||
if (!result) { | ||
result = '['; | ||
} else if (tab) { | ||
result += '\n' + Blast.Bound.String.multiply('\t', tab-1); | ||
} | ||
result += ']'; | ||
return result; | ||
}, true); | ||
/** | ||
* Fill all the elements of the array from a start index | ||
@@ -626,3 +572,3 @@ * to an end index with a static value | ||
// Add the array | ||
Collection.Array.prototype.include.call(result, i, flatten.call(temp, limit-1)); | ||
Collection.Array.prototype.include.call(result, result.length, flatten.call(temp, limit-1)); | ||
} else { | ||
@@ -629,0 +575,0 @@ result.push(this[i]); |
@@ -95,3 +95,3 @@ module.exports = function BlastBenchmark(Blast, Collection) { | ||
* @since 0.1.2 | ||
* @version 0.3.0 | ||
* @version 0.4.0 | ||
* | ||
@@ -102,6 +102,12 @@ * @param {Number} runs | ||
var dummy = Function(), | ||
var dummy, | ||
start, | ||
i; | ||
// The dummy has to return something, | ||
// or it'll get insanely optimized | ||
dummy = function() { | ||
return 1; | ||
}; | ||
// Call dummy now to get it jitted | ||
@@ -108,0 +114,0 @@ dummy(); |
@@ -97,15 +97,2 @@ module.exports = function BlastDate(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the date. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('Date', 'toSource', function toSource() { | ||
return '(new Date(' + Date.prototype.valueOf.call(this) + '))'; | ||
}, true); | ||
/** | ||
* Return a clone of the current date | ||
@@ -112,0 +99,0 @@ * |
@@ -100,23 +100,2 @@ module.exports = function BlastDeck(Blast, Collection) { | ||
/** | ||
* Get the source code representation of this deck | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.2 | ||
* @version 0.1.4 | ||
* | ||
* @return {String} | ||
*/ | ||
Deck.setMethod('toSource', function toSource() { | ||
var src = '(function(){'; | ||
src += 'var a = new _Protoblast.Classes.Deck();'; | ||
src += 'a.insertCount=' + JSON.stringify(this.insertCount) + ';'; | ||
src += 'a.dict=' + JSON.stringify(this.dict) + ';'; | ||
src += 'return a;' | ||
src += '}())'; | ||
return src; | ||
}); | ||
/** | ||
* Return an object for json-drying this object | ||
@@ -123,0 +102,0 @@ * |
module.exports = function BlastError(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the error. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.4 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('Error', 'toSource', function toSource() { | ||
var name = this.name, | ||
message = JSON.stringify(this.message), | ||
fileName = JSON.stringify(this.fileName), | ||
lineno = this.lineNumber; | ||
lineno = ((lineno === 0 || lineno == null) ? '' : ', ' + lineno); | ||
return '(new ' + name + '(' + message + ', ' + fileName + lineno + '))'; | ||
}, true); | ||
/** | ||
* Revive a JSON-died error | ||
@@ -26,0 +5,0 @@ * |
@@ -97,3 +97,3 @@ module.exports = function BlastFunctionFlow(Blast, Collection) { | ||
* @since 0.1.2 | ||
* @version 0.1.9 | ||
* @version 0.4.0 | ||
* | ||
@@ -112,3 +112,6 @@ * @param {Boolean} _forceAsync Force asynchronous behaviour [TRUE] | ||
results, | ||
pledge, | ||
length, | ||
tasks, | ||
part, | ||
keys, | ||
@@ -119,2 +122,4 @@ temp, | ||
pledge = new Blast.Classes.Pledge(); | ||
// Normalize parameters | ||
@@ -149,2 +154,5 @@ if (typeof _forceAsync == 'boolean') { | ||
// Get the amount of tasks | ||
length = keys.length; | ||
// The result object will also be an object | ||
@@ -169,7 +177,10 @@ results = Collection.Object.mapKeys(keys); | ||
// Get the amount of tasks | ||
length = tasks.length; | ||
// The keys are numeric | ||
keys = Collection.Array.range(0, tasks.length); | ||
keys = Collection.Array.range(0, length); | ||
// The results will be an array | ||
results = new Array(tasks.length); | ||
results = new Array(length); | ||
} | ||
@@ -181,2 +192,3 @@ | ||
part = 100 / length; | ||
i = -1; | ||
@@ -196,2 +208,3 @@ | ||
stop = true; | ||
pledge.reject(err); | ||
return callback(err); | ||
@@ -208,2 +221,5 @@ } | ||
// Report the progress | ||
pledge.addProgress(part); | ||
// See if we need to do another task | ||
@@ -222,2 +238,3 @@ if (tasks[next]) { | ||
stop = true; | ||
pledge.reject(err); | ||
return callback(err); | ||
@@ -230,2 +247,3 @@ } | ||
callback(null, results); | ||
pledge.resolve(results); | ||
}); | ||
@@ -237,2 +255,4 @@ } | ||
handler(); | ||
return pledge; | ||
}); | ||
@@ -245,3 +265,3 @@ | ||
* @since 0.1.2 | ||
* @version 0.1.9 | ||
* @version 0.4.0 | ||
*/ | ||
@@ -261,4 +281,6 @@ Blast.defineStatic('Function', 'parallel', function parallel(_forceAsync, _limit, _tasks, _callback) { | ||
length, | ||
pledge, | ||
tasks, | ||
limit, | ||
part, | ||
skip, | ||
@@ -273,2 +295,3 @@ args, | ||
skip = 0; | ||
pledge = new Blast.Classes.Pledge(); | ||
@@ -362,5 +385,6 @@ if (typeof _forceAsync === 'boolean') { | ||
callback(null, results); | ||
pledge.resolve(results); | ||
}); | ||
return; | ||
return pledge; | ||
} | ||
@@ -371,2 +395,3 @@ | ||
started = 0; | ||
part = 100 / length; | ||
@@ -387,2 +412,3 @@ handler = function blastParallelHandler(i, err, result) { | ||
stop = true; | ||
pledge.reject(err); | ||
return callback(err); | ||
@@ -394,2 +420,5 @@ } | ||
// Report the progress | ||
pledge.addProgress(part); | ||
// If we need to start any other functions, do it now | ||
@@ -408,2 +437,3 @@ if (!stillStarting && started < length) { | ||
stop = true; | ||
pledge.reject(err); | ||
return callback(err); | ||
@@ -420,2 +450,3 @@ } | ||
callback(null, results); | ||
pledge.resolve(results); | ||
}); | ||
@@ -447,2 +478,3 @@ } | ||
stop = true; | ||
pledge.reject(err); | ||
return callback(err); | ||
@@ -460,2 +492,4 @@ } | ||
stillStarting = false; | ||
return pledge; | ||
}); | ||
@@ -462,0 +496,0 @@ |
@@ -60,15 +60,37 @@ module.exports = function BlastFunction(Blast, Collection) { | ||
* @since 0.1.0 | ||
* @version 0.1.5 | ||
* @version 0.4.0 | ||
* | ||
* @param {String} name The name of the function | ||
* @param {Function} fnc The function body | ||
* @param {String} name The name of the function | ||
* @param {String|Array} args Optional argument names to use | ||
* @param {Function} fnc The function body | ||
* | ||
* @return {Function} | ||
*/ | ||
Blast.defineStatic('Function', 'create', function create(name, fnc) { | ||
Blast.defineStatic('Function', 'create', function create(name, args, fnc) { | ||
var result; | ||
var result, | ||
args, | ||
i; | ||
eval('result = function ' + name + '(){return fnc.apply(this, arguments);}'); | ||
if (typeof args == 'function') { | ||
fnc = args; | ||
args = null; | ||
} | ||
if (args) { | ||
if (typeof args != 'string') { | ||
if (Array.isArray(args)) { | ||
args = args.join(', '); | ||
} else { | ||
throw new TypeError('The arguments parameter needs to be a string or array'); | ||
} | ||
} | ||
} else if (fnc.length) { | ||
args = Collection.Function.getArgumentNames(fnc).join(', '); | ||
} else { | ||
args = ''; | ||
} | ||
eval('result = function ' + name + '(' + args + ') {return fnc.apply(this, arguments);}'); | ||
// Store the new wrapper function on fnc | ||
@@ -278,32 +300,2 @@ fnc.wrapper = result; | ||
/** | ||
* Return a string representing the source code of the function. | ||
* Also attempts to return native code references, | ||
* or at least non-error causing functions. | ||
* | ||
* Overwrites existing method in Firefox. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('Function', 'toSource', function toSource() { | ||
// Get a string representation of the function | ||
var str = this.toString(); | ||
// If this is native code, just return the name | ||
if (str.slice(-17) == '{ [native code] }') { | ||
if (Blast.Globals[this.name] === this) { | ||
return this.name; | ||
} else { | ||
return '(function ' + this.name + '(){throw new Error("Could not uneval native code!")})'; | ||
} | ||
} | ||
return '(' + str + ')'; | ||
}); | ||
/** | ||
* Convert this function sourcecode to tokens | ||
@@ -310,0 +302,0 @@ * |
@@ -61,2 +61,151 @@ module.exports = function BlastInformer(Blast, Collection) { | ||
/** | ||
* Set a prototype method on the given constructor | ||
* that will wait for the given event (filter). | ||
* The method will always return a promise in the form of the Pledge class. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.4.0 | ||
* @version 0.4.0 | ||
* | ||
* @param {Object|String} filter The event filter | ||
* @param {String} key Name to use (defaults to method name) | ||
* @param {Function} method The method to set | ||
* | ||
* @return {Function} | ||
*/ | ||
Informer.setStatic(function setAfterMethod(filter, key, method) { | ||
var wrapper, | ||
args; | ||
if (typeof key == 'function') { | ||
method = key; | ||
key = method.name; | ||
} | ||
// Get the names of the arguments of the method to set | ||
args = Collection.Function.getArgumentNames(method); | ||
// Create the wrapper | ||
wrapper = Collection.Function.create(key, args, function wrapper() { | ||
var that = this, | ||
pledge = new Blast.Classes.Pledge, | ||
args = arguments; | ||
this.afterOnce(filter, function done() { | ||
var result; | ||
try { | ||
result = method.apply(that, args); | ||
pledge.resolve(result); | ||
} catch (err) { | ||
pledge.reject(err); | ||
} | ||
}); | ||
return pledge; | ||
}); | ||
// Set the wrapper as the new method | ||
return this.setMethod(key, wrapper); | ||
}); | ||
/** | ||
* Set a prototype method on the given constructor | ||
* that will execute the task once and cache the result. | ||
* The method will always return a promise in the form of the Pledge class. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.4.0 | ||
* @version 0.4.0 | ||
* | ||
* @param {String} key Name to use (defaults to method name) | ||
* @param {Function} method The method to set | ||
* | ||
* @return {Function} | ||
*/ | ||
Informer.setStatic(function setCacheMethod(key, method) { | ||
var wrapper, | ||
args; | ||
if (typeof key == 'function') { | ||
method = key; | ||
key = method.name; | ||
} | ||
// Get the names of the arguments of the method to set | ||
args = Collection.Function.getArgumentNames(method); | ||
// Create the wrapper | ||
wrapper = Collection.Function.create(key, args, function wrapper() { | ||
var that = this, | ||
new_args, | ||
callback, | ||
pledge, | ||
args = arguments, | ||
i; | ||
// Extract the callback | ||
if (args.length && typeof args[args.length - 1] == 'function') { | ||
callback = args[args.length - 1]; | ||
} | ||
// If the _method_cache object doesn't exist yet, | ||
// make it now | ||
if (this._method_cache == null) { | ||
this._method_cache = {}; | ||
} | ||
if (!this._method_cache[key]) { | ||
// This is the first time the method has been called! | ||
pledge = new Blast.Classes.Pledge; | ||
this._method_cache[key] = pledge; | ||
} | ||
// If there already is a pledge in the method cache object, | ||
// use it to add this call | ||
if (this._method_cache[key]) { | ||
this._method_cache[key].then(function doMethod(result) { | ||
callback(null, result); | ||
}); | ||
this._method_cache[key].catch(function doMethod(err) { | ||
callback(err); | ||
}); | ||
// This return will only be called if it's not the first time | ||
if (!pledge) { | ||
return this._method_cache[key]; | ||
} | ||
} | ||
new_args = []; | ||
for (i = 0; i < args.length - 1; i++) { | ||
new_args.push(args[i]); | ||
} | ||
new_args.push(function done(err, result) { | ||
if (err) { | ||
return pledge.reject(err); | ||
} | ||
pledge.resolve(result); | ||
}); | ||
method.apply(that, new_args); | ||
return pledge; | ||
}); | ||
// Set the wrapper as the new method | ||
return this.setMethod(key, wrapper); | ||
}); | ||
/** | ||
* Try/catch function, return error object or null | ||
@@ -63,0 +212,0 @@ * |
@@ -136,3 +136,2 @@ module.exports = function BlastInit(modifyPrototype) { | ||
'Array', | ||
'Boolean', | ||
'Crypto', | ||
@@ -149,2 +148,3 @@ 'Date', | ||
'Math', | ||
'Pledge', | ||
'SeededRng', | ||
@@ -640,3 +640,2 @@ 'Number', | ||
'benchmark', | ||
'misc', | ||
'string_compression', | ||
@@ -852,3 +851,2 @@ 'string_compressed_entities', | ||
require('./sorting.js')(Blast, Collection); | ||
require('./misc.js')(Blast, Collection); | ||
@@ -855,0 +853,0 @@ if (Blast.isBrowser) { |
@@ -79,15 +79,2 @@ /** | ||
/** | ||
* Return a string representing the source code of the object. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.defineStatic('JSON', 'toSource', function toSource() { | ||
return 'JSON'; | ||
}, true); | ||
/** | ||
* Generate a replacer function | ||
@@ -94,0 +81,0 @@ * |
module.exports = function BlastMath(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the object. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.defineStatic('Math', 'toSource', function toSource() { | ||
return 'Math'; | ||
}, true); | ||
/** | ||
* Return the n lowest numbers | ||
@@ -18,0 +5,0 @@ * |
@@ -164,15 +164,2 @@ module.exports = function BlastNumber(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the number. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('Number', 'toSource', function toSource() { | ||
return '(new Number(' + this + '))'; | ||
}, true); | ||
/** | ||
* Returns the number as a string with leading zeros to get the | ||
@@ -179,0 +166,0 @@ * desired length |
module.exports = function BlastObject(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the object. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @param {Boolean|Number} tab If indent should be used | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('Object', 'toSource', function toSource(tab) { | ||
var result = '', | ||
passtab, | ||
type, | ||
key; | ||
if (tab === true) { | ||
tab = 1; | ||
} | ||
if (tab > 0) { | ||
passtab = tab + 1; | ||
} else { | ||
passtab = tab; | ||
tab = 0; | ||
} | ||
for (key in this) { | ||
if (this.hasOwnProperty(key)) { | ||
type = typeof this[key]; | ||
if (!result) { | ||
result = '({'; | ||
} else { | ||
result += ','; | ||
} | ||
if (tab) { | ||
result += '\n'; | ||
} | ||
result += Blast.Bound.String.multiply('\t', tab) + JSON.stringify(key) + ': '; | ||
result += Blast.uneval(this[key], passtab); | ||
} | ||
} | ||
if (!result) { | ||
result = '({'; | ||
} else { | ||
if (tab) { | ||
result += '\n' + Blast.Bound.String.multiply('\t', tab-1); | ||
} | ||
} | ||
result += '})'; | ||
return result; | ||
}, true); | ||
/** | ||
* Get the property descriptor of the given object, | ||
@@ -1215,3 +1153,3 @@ * follow the prototype chain if not found | ||
* @since 0.1.3 | ||
* @version 0.3.10 | ||
* @version 0.4.0 | ||
* | ||
@@ -1240,6 +1178,2 @@ * @param {Object|Array} obj | ||
if (!seen || !Array.isArray(seen)) { | ||
seen = [obj]; | ||
} | ||
// Make sure primitives are primitive | ||
@@ -1318,2 +1252,8 @@ if (type == 'object' && obj != null && typeof obj.valueOf == 'function') { | ||
} else if (typeof val == 'object') { | ||
// Make sure seen exists | ||
if (!seen) { | ||
seen = [obj]; | ||
} | ||
// Handle objects recursively, but beware of circular references | ||
@@ -1350,12 +1290,17 @@ if ((idx = seen.indexOf(val)) == -1) { | ||
* @since 0.1.3 | ||
* @version 0.3.4 | ||
* @version 0.4.0 | ||
* | ||
* @param {Object} a | ||
* @param {Object} b | ||
* @param {Array} seen | ||
* | ||
* @return {Boolean} | ||
*/ | ||
Blast.defineStatic('Object', 'alike', function alike(a, b) { | ||
Blast.defineStatic('Object', 'alike', function alike(a, b, seen) { | ||
var key; | ||
var index_a, | ||
index_b, | ||
id_a, | ||
id_b, | ||
key; | ||
@@ -1391,2 +1336,9 @@ // If they're equals, return true | ||
if (!seen) { | ||
seen = { | ||
objects : [], | ||
ids : [] | ||
}; | ||
} | ||
for (key in a) { | ||
@@ -1406,3 +1358,42 @@ | ||
default: | ||
if (!alike(a[key], b[key])) { | ||
index_a = seen.objects.indexOf(a[key]); | ||
index_b = seen.objects.indexOf(b[key]); | ||
// If any of the 2 objects have been seen before, | ||
// we'll have to do a more expensive check | ||
if (index_a > -1 || index_b > -1) { | ||
id_a = null; | ||
id_b = null; | ||
if (index_a > -1) { | ||
id_a = seen.ids[index_a]; | ||
} else { | ||
index_a = seen.objects.push(a[key]) - 1; | ||
} | ||
if (!id_a) { | ||
id_a = Blast.Bound.Object.checksum(a[key]); | ||
seen.ids[index_a] = id_a; | ||
} | ||
if (index_b > -1) { | ||
id_b = seen.ids[index_b]; | ||
} else { | ||
index_b = seen.objects.push(b[key]) - 1; | ||
} | ||
if (!id_b) { | ||
id_b = Blast.Bound.Object.checksum(b[key]); | ||
seen.ids[index_b] = id_b; | ||
} | ||
return id_a == id_b; | ||
} else { | ||
// Both elements haven't been seen before | ||
seen.objects.push(a[key]); | ||
seen.objects.push(b[key]); | ||
} | ||
if (!alike(a[key], b[key], seen)) { | ||
return false; | ||
@@ -1409,0 +1400,0 @@ } |
@@ -86,15 +86,2 @@ module.exports = function BlastRegExp(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the regular expression. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('RegExp', 'toSource', function toSource() { | ||
return this.toString(); | ||
}, true); | ||
/** | ||
* Return the pattern. | ||
@@ -101,0 +88,0 @@ * |
@@ -90,3 +90,3 @@ module.exports = function BlastRequest(Blast, Collection) { | ||
* @since 0.2.0 | ||
* @version 0.3.7 | ||
* @version 0.4.0 | ||
* | ||
@@ -99,2 +99,3 @@ * @param {Object} options | ||
var that = this, | ||
body_data, | ||
protocol, | ||
@@ -115,2 +116,10 @@ config, | ||
if (options.get) { | ||
url.addQuery(options.get); | ||
} | ||
if (options.head) { | ||
url.addQuery(options.head); | ||
} | ||
config = { | ||
@@ -129,10 +138,36 @@ host : url.hostname, | ||
if (options.head) { | ||
config.method = 'HEAD'; | ||
} | ||
if (options.post) { | ||
config.method = 'POST'; | ||
body_data = options.post; | ||
} | ||
if (typeof options.post == 'object') { | ||
if (options.put) { | ||
config.method = 'PUT'; | ||
body_data = options.put; | ||
} | ||
if (options.delete) { | ||
config.method = 'DELETE'; | ||
body_data = options.delete; | ||
} | ||
if (options.options) { | ||
config.method = 'OPTIONS'; | ||
} | ||
if (options.patch) { | ||
config.method = 'PATCH'; | ||
body_data = options.patch; | ||
} | ||
if (body_data) { | ||
if (typeof body_data == 'object') { | ||
config.headers['Content-Type'] = 'application/json'; | ||
body = JSON.stringify(options.post); | ||
body = JSON.stringify(body_data); | ||
} else { | ||
body = String(options.post); | ||
body = String(body_data); | ||
} | ||
@@ -139,0 +174,0 @@ |
@@ -262,15 +262,2 @@ module.exports = function BlastString(Blast, Collection) { | ||
/** | ||
* Return a string representing the source code of the object. | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* | ||
* @return {String} | ||
*/ | ||
Blast.definePrototype('String', 'toSource', function toSource() { | ||
return '(new String(' + JSON.stringify(this) + '))'; | ||
}, true); | ||
/** | ||
* Trim left | ||
@@ -277,0 +264,0 @@ * |
{ | ||
"name": "protoblast", | ||
"description": "Native object expansion library", | ||
"version": "0.3.10", | ||
"version": "0.4.0", | ||
"author": "Jelle De Loecker <jelle@develry.be>", | ||
@@ -18,3 +18,5 @@ "keywords": [ | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha --reporter spec" | ||
"test" : "node_modules/.bin/mocha --reporter spec", | ||
"coverage" : "./node_modules/istanbul/lib/cli.js cover _mocha", | ||
"report-coverage" : "cat ./coverage/lcov.info | coveralls" | ||
}, | ||
@@ -26,2 +28,3 @@ "main": "lib/init.js", | ||
"git-rev" : "0.2.1", | ||
"istanbul" : "^0.4.5", | ||
"matcha" : "skerit/matcha", | ||
@@ -32,4 +35,4 @@ "mocha" : "1.20.x", | ||
"engines": { | ||
"node": ">=0.11" | ||
"node": ">=4.8" | ||
} | ||
} |
# ![protoblast](https://protoblast.develry.be/media/static/protoblast-small.svg?width=30) Protoblast | ||
[![NPM version](http://img.shields.io/npm/v/protoblast.svg)](https://npmjs.org/package/protoblast) | ||
[![Build Status](https://secure.travis-ci.org/skerit/protoblast.png?branch=master)](http://travis-ci.org/skerit/protoblast) | ||
[![Build Status](https://travis-ci.org/skerit/protoblast.svg?branch=master)](https://travis-ci.org/skerit/protoblast) | ||
[![Coverage Status](https://coveralls.io/repos/github/skerit/protoblast/badge.svg?branch=master)](https://coveralls.io/github/skerit/protoblast?branch=master) | ||
@@ -6,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
477345
7
43
15718