protoblast
Advanced tools
Comparing version 0.7.8 to 0.7.9
@@ -0,1 +1,8 @@ | ||
## 0.7.9 (2021-06-11) | ||
* Recursively call `clearAndDoTasks()` to make sure new tasks are also called | ||
* `Function.constitute()` will only immediately queue the constitutor when blast has loaded fully, not also when it is loading | ||
* Fix `Date#format()` breaking on Safari 14.1 when used with a timezone | ||
* `JSON.safeParse()` will now remove BOM (byte order marker) | ||
## 0.7.8 (2021-04-29) | ||
@@ -2,0 +9,0 @@ |
@@ -81,3 +81,3 @@ /** | ||
* @since 0.1.4 | ||
* @version 0.7.5 | ||
* @version 0.7.9 | ||
* | ||
@@ -96,10 +96,24 @@ * @param {String} pattern | ||
// Convert the date to a string in the wanted timezone | ||
// (but without it mentioning said timezone) | ||
let cloned = date.toLocaleString('en-US', { | ||
timeZone: timezone, | ||
let cloned; | ||
let options = { | ||
timeZone : timezone, | ||
dateStyle : 'medium', | ||
timeStyle : 'medium' | ||
}); | ||
}; | ||
// Convert the date to a string in the wanted timezone | ||
// (but without it mentioning said timezone) | ||
if (Blast.isBrowser) { | ||
cloned = (new Intl.DateTimeFormat('en-US', options)).format(this); | ||
// Safari 14.1+ replaced the comma separator between the date & time | ||
// with the word " at ", which breaks everything. So remove that. | ||
if (cloned.indexOf(' at ') > -1) { | ||
cloned = cloned.replace(' at ', ' '); | ||
} | ||
} else { | ||
cloned = date.toLocaleString('en-US', options); | ||
} | ||
// Now interpret that date in the current timezone | ||
@@ -106,0 +120,0 @@ date = new Date(cloned); |
@@ -860,3 +860,3 @@ var finished_constitutors = new WeakMap(), | ||
* @since 0.1.4 | ||
* @version 0.6.5 | ||
* @version 0.7.9 | ||
* | ||
@@ -868,4 +868,2 @@ * @param {Function} constructor | ||
var tasks = constructor.constitutors; | ||
if (constructor.prototype.waitingConstitute) { | ||
@@ -876,2 +874,4 @@ constructor.prototype.waitingConstitute.push(task); | ||
let tasks = constructor.constitutors; | ||
if (tasks == null) { | ||
@@ -886,3 +886,3 @@ tasks = []; | ||
// If blast has already loaded, perform the constitutor | ||
if (Blast.loaded() || Blast.loading) { | ||
if (Blast.loaded()) { | ||
@@ -896,3 +896,3 @@ // If doConstitutors has already been called for this constructor, | ||
Blast.queueImmediate(function doConstitutor() { | ||
Blast.queueImmediate(function doQueuedConstitutor() { | ||
doConstructorTask(constructor, task); | ||
@@ -899,0 +899,0 @@ }); |
@@ -1457,9 +1457,18 @@ module.exports = function BlastInitLoader(modifyPrototype) { | ||
* @since 0.6.5 | ||
* @version 0.6.5 | ||
* @version 0.7.9 | ||
* | ||
* @param {Array} arr | ||
* @param {number} level | ||
*/ | ||
function clearAndDoTasks(arr) { | ||
function clearAndDoTasks(arr, level) { | ||
var tasks = arr.slice(0), | ||
let tasks = arr.slice(0), | ||
i; | ||
if (level == null) { | ||
level = 0; | ||
} | ||
level++; | ||
// Clear the original array | ||
@@ -1471,2 +1480,8 @@ arr.length = 0; | ||
} | ||
// Recursively clear the tasks should now ones have been added, | ||
// but make sure we don't get stuck in an infinite loop | ||
if (arr.length && level < 10) { | ||
clearAndDoTasks(arr); | ||
} | ||
} | ||
@@ -1473,0 +1488,0 @@ |
@@ -92,5 +92,5 @@ var Dry = require('json-dry'); | ||
* | ||
* @author Jelle De Loecker <jelle@develry.be> | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 0.2.0 | ||
* @version 0.2.0 | ||
* @version 0.7.9 | ||
* | ||
@@ -101,2 +101,10 @@ * @return {Mixed} | ||
try { | ||
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) | ||
// because the buffer-to-string conversion | ||
// translates it to FEFF, the UTF-16 BOM. | ||
if (text.charCodeAt(0) === 0xFEFF) { | ||
text = text.slice(1); | ||
} | ||
return JSON.parse(text, reviver); | ||
@@ -103,0 +111,0 @@ } catch (err) { |
{ | ||
"name": "protoblast", | ||
"description": "Native object expansion library", | ||
"version": "0.7.8", | ||
"version": "0.7.9", | ||
"author": "Jelle De Loecker <jelle@elevenways.be>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
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
706245
29343