protoblast
Advanced tools
Comparing version 0.5.8 to 0.5.9
@@ -0,1 +1,8 @@ | ||
## 0.5.9 (2018-07-10) | ||
* Fix `Object.formPath` and `Object.setFormPath` not finding correct RURL methods | ||
* Add `limit` support to `Function.forEach.parallel` | ||
* Add `String#isEmptyWhitespace()` to test if the string is empty or has only whitespace | ||
* Add `String#isEmptyWhitespaceHTML()` to test if the string is empty or has only whitespace, including HTML elements | ||
## 0.5.8 (2018-07-04) | ||
@@ -2,0 +9,0 @@ |
@@ -70,2 +70,6 @@ module.exports = function BlastBenchmark(Blast, Collection, Bound) { | ||
// Default test sizes | ||
Blast.benchmark_sync_sizes = [1, 10, 120, 120, 240, 240, 240, 480]; | ||
Blast.benchmark_async_sizes = [120, 120, 120, 240, 240, 480]; | ||
/** | ||
@@ -135,3 +139,3 @@ * Do some simple benchmarking | ||
* @since 0.1.2 | ||
* @version 0.1.4 | ||
* @version 0.5.9 | ||
* | ||
@@ -158,3 +162,3 @@ * @param {Function} fn | ||
// The wanted milliseconds per test | ||
sizes = [1, 10, 120, 120, 240, 240, 240, 480]; | ||
sizes = Blast.benchmark_sync_sizes; | ||
samples = []; | ||
@@ -219,3 +223,3 @@ result = {}; | ||
* @since 0.1.2 | ||
* @version 0.1.4 | ||
* @version 0.5.9 | ||
* | ||
@@ -238,3 +242,3 @@ * @param {Function} fn | ||
sizes = [120, 120, 120, 240, 240, 480]; | ||
sizes = Blast.benchmark_async_sizes; | ||
samples = []; | ||
@@ -241,0 +245,0 @@ result = {}; |
@@ -5,3 +5,4 @@ module.exports = function BlastCrypto(Blast, Collection) { | ||
var libcrypto, | ||
var addRandomValues, | ||
libcrypto, | ||
instance; | ||
@@ -185,3 +186,3 @@ | ||
*/ | ||
function addRandomValues(arr) { | ||
addRandomValues = function addRandomValues(arr) { | ||
@@ -197,3 +198,3 @@ var i; | ||
} | ||
} | ||
}; | ||
@@ -200,0 +201,0 @@ /** |
@@ -300,3 +300,3 @@ module.exports = function BlastFunctionFlow(Blast, Collection, Bound) { | ||
* @since 0.1.2 | ||
* @version 0.5.6 | ||
* @version 0.5.9 | ||
*/ | ||
@@ -353,4 +353,9 @@ Blast.defineStatic('Function', 'parallel', function parallel(_forceAsync, _limit, _tasks, _callback) { | ||
if (typeof limit === 'number') { | ||
setLimit = true; | ||
skip += 1; | ||
if (limit > 0) { | ||
setLimit = true; | ||
skip += 1; | ||
} else { | ||
setLimit = false; | ||
skip = 1; | ||
} | ||
} else { | ||
@@ -692,12 +697,19 @@ | ||
* @since 0.1.8 | ||
* @version 0.1.8 | ||
* @version 0.5.9 | ||
* | ||
* @param {Function} test | ||
* @param {Function} task | ||
* @param {Function} callback | ||
* @param {Array|Object} data | ||
* @param {Function} task | ||
* @param {Function} callback | ||
*/ | ||
forEach.parallel = function forEachParallel(data, task, callback) { | ||
forEach.parallel = function forEachParallel(limit, data, task, callback) { | ||
var tasks = []; | ||
if (typeof limit != 'number') { | ||
callback = task; | ||
task = data; | ||
data = limit; | ||
limit = 0; | ||
} | ||
if (Array.isArray(data)) { | ||
@@ -717,3 +729,3 @@ data.forEach(function eachEntry(entry, index) { | ||
return Blast.Collection.Function.parallel(tasks, callback); | ||
return Blast.Collection.Function.parallel(limit, tasks, callback); | ||
}; | ||
@@ -720,0 +732,0 @@ |
@@ -650,3 +650,3 @@ module.exports = function BlastObject(Blast, Collection, Bound, Obj) { | ||
* @since 0.1.11 | ||
* @version 0.5.7 | ||
* @version 0.5.9 | ||
* | ||
@@ -657,3 +657,3 @@ * @param {Object} obj | ||
Blast.defineStatic('Object', 'formPath', function formPath(obj, form_path) { | ||
var path = Collection.RURL.parseFormPath(form_path); | ||
var path = Blast.Classes.RURL.parseFormPath(form_path); | ||
return Collection.Object.path(obj, path); | ||
@@ -669,6 +669,6 @@ }); | ||
* @since 0.1.11 | ||
* @version 0.5.7 | ||
* @version 0.5.9 | ||
*/ | ||
Blast.defineStatic('Object', 'setFormPath', function setFormPath(obj, form_path, value, skipLastEntry) { | ||
var path = Collection.RURL.parseFormPath(form_path); | ||
var path = Blast.Classes.RURL.parseFormPath(form_path); | ||
return Collection.Object.setPath(obj, path, value, skipLastEntry); | ||
@@ -675,0 +675,0 @@ }); |
@@ -105,11 +105,21 @@ // Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, and Domenic Denicola | ||
var realSetImmediate; | ||
var installReadyStateChangeImplementation, | ||
installMessageChannelImplementation, | ||
installPostMessageImplementation, | ||
installSetTimeoutImplementation, | ||
installNextTickImplementation, | ||
addFromSetImmediateArguments, | ||
canUsePostMessage, | ||
partiallyApplied, | ||
clearImmediate, | ||
runIfPresent; | ||
function addFromSetImmediateArguments(args) { | ||
addFromSetImmediateArguments = function addFromSetImmediateArguments(args) { | ||
tasksByHandle[nextHandle] = partiallyApplied.apply(undefined, args); | ||
return nextHandle++; | ||
} | ||
}; | ||
// This function accepts the same arguments as setImmediate, but | ||
// returns a function that requires no arguments. | ||
function partiallyApplied(handler) { | ||
partiallyApplied = function partiallyApplied(handler) { | ||
@@ -130,5 +140,5 @@ var args, | ||
}; | ||
} | ||
}; | ||
function runIfPresent(handle) { | ||
runIfPresent = function runIfPresent(handle) { | ||
// From the spec: "Wait until any invocations of this algorithm started before this one have completed." | ||
@@ -152,9 +162,9 @@ // So if we're currently running a task, we'll need to delay this invocation. | ||
} | ||
} | ||
}; | ||
function clearImmediate(handle) { | ||
clearImmediate = function clearImmediate(handle) { | ||
delete tasksByHandle[handle]; | ||
} | ||
}; | ||
function installNextTickImplementation() { | ||
installNextTickImplementation = function installNextTickImplementation() { | ||
realSetImmediate = function setImmediateNexttick() { | ||
@@ -165,5 +175,5 @@ var handle = addFromSetImmediateArguments(arguments); | ||
}; | ||
} | ||
}; | ||
function canUsePostMessage() { | ||
canUsePostMessage = function canUsePostMessage() { | ||
// The test against `importScripts` prevents this implementation from being installed inside a web worker, | ||
@@ -181,5 +191,5 @@ // where `global.postMessage` means something completely different and can't be used for this purpose. | ||
} | ||
} | ||
}; | ||
function installPostMessageImplementation() { | ||
installPostMessageImplementation = function installPostMessageImplementation() { | ||
// Installs an event handler on `global` for the `message` event: see | ||
@@ -209,5 +219,5 @@ // * https://developer.mozilla.org/en/DOM/window.postMessage | ||
}; | ||
} | ||
}; | ||
function installMessageChannelImplementation() { | ||
installMessageChannelImplementation = function installMessageChannelImplementation() { | ||
var channel = new MessageChannel(); | ||
@@ -226,3 +236,3 @@ channel.port1.onmessage = function onmessage(event) { | ||
function installReadyStateChangeImplementation() { | ||
installReadyStateChangeImplementation = function installReadyStateChangeImplementation() { | ||
var html = doc.documentElement; | ||
@@ -243,5 +253,5 @@ realSetImmediate = function setImmediateStatechange() { | ||
}; | ||
} | ||
}; | ||
function installSetTimeoutImplementation() { | ||
installSetTimeoutImplementation = function installSetTimeoutImplementation() { | ||
realSetImmediate = function setImmediateTimeout() { | ||
@@ -252,3 +262,3 @@ var handle = addFromSetImmediateArguments(arguments); | ||
}; | ||
} | ||
}; | ||
@@ -255,0 +265,0 @@ // Don't get fooled by e.g. browserify environments. |
@@ -1762,2 +1762,49 @@ module.exports = function BlastString(Blast, Collection, Bound, Obj) { | ||
var whitespace_regex = /^\s*$/; | ||
/** | ||
* Is this an empty or whitespace string? | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.5.9 | ||
* @version 0.5.9 | ||
* | ||
* @return {Boolean} | ||
*/ | ||
Blast.definePrototype('String', 'isEmptyWhitespace', function isEmptyWhitespace() { | ||
var len = this.length, | ||
i; | ||
if (!len) { | ||
return true; | ||
} | ||
return whitespace_regex.test(this); | ||
}); | ||
/** | ||
* Is this an empty or whitespace string, with all HTML tags removed? | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @since 0.5.9 | ||
* @version 0.5.9 | ||
* | ||
* @return {Boolean} | ||
*/ | ||
Blast.definePrototype('String', 'isEmptyWhitespaceHTML', function isEmptyWhitespaceHTML() { | ||
var str; | ||
if (Blast.Bound.String.isEmptyWhitespace(this)) { | ||
return true; | ||
} | ||
if (~this.indexOf('<') && ~this.indexOf('>')) { | ||
str = Blast.Bound.String.stripTags(this); | ||
return Blast.Bound.String.isEmptyWhitespace(str); | ||
} | ||
return false; | ||
}); | ||
}; |
{ | ||
"name": "protoblast", | ||
"description": "Native object expansion library", | ||
"version": "0.5.8", | ||
"version": "0.5.9", | ||
"author": "Jelle De Loecker <jelle@develry.be>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
<h1 align="center"> | ||
<img src="https://protoblast.develry.be/media/static/protoblast-small.png?width=30" alt="Protoblast logo"/> | ||
<img src="https://protoblast.develry.be/media/static/protoblast-small.png" width=30 alt="Protoblast logo"/> | ||
<b>Protoblast</b> | ||
@@ -4,0 +4,0 @@ </h1> |
537556
22043