core-functions
Advanced tools
Comparing version 2.0.14 to 2.0.15
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -124,3 +124,13 @@ 'use strict'; | ||
function newDest(object) { | ||
return Array.isArray(object) ? new Array(object.length) : Object.create(object.__proto__); | ||
if (Array.isArray(object)) { | ||
return new Array(object.length); | ||
} | ||
const prototype = Object.getPrototypeOf(object); // | ||
if (prototype === undefined) { | ||
console.trace(`#################### WARNING - Object.getPrototypeOf(object) has an undefined prototype - stringified: (${Strings.stringify(object)}) inspected: (${require('util').inspect(object)}) - using Object.create(null) instead!`); | ||
} | ||
if (object.__proto__ === undefined) { | ||
console.trace(`#################### WARNING - object.__proto__ has an undefined prototype - stringified: (${Strings.stringify(object)}) inspected: (${require('util').inspect(object)}) - using Object.create(null) instead!`); | ||
} | ||
return Object.create(prototype || null); | ||
} | ||
@@ -127,0 +137,0 @@ |
{ | ||
"name": "core-functions", | ||
"version": "2.0.14", | ||
"version": "2.0.15", | ||
"description": "Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including strings, booleans, Promises, base 64, Arrays, Objects, standard AppErrors, etc.", | ||
@@ -5,0 +5,0 @@ "author": "Byron du Preez", |
@@ -1,2 +0,2 @@ | ||
# core-functions v2.0.14 | ||
# core-functions v2.0.15 | ||
@@ -106,2 +106,6 @@ Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including | ||
### 2.0.15 | ||
- Backport of `objects` module `copy` function fix for TypeError thrown when `Object.create(o.__proto__)` was invoked & `o.__proto__` was undefined | ||
- Backport of fix for `strings.test.js` equality failure that surfaces when run under Node 6.10.x | ||
### 2.0.14 | ||
@@ -108,0 +112,0 @@ - Added `copyNamedProperties` function to `objects.js` module |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"prefixFnArgs": true | ||
} |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -852,2 +852,17 @@ 'use strict'; | ||
t.end(); | ||
}); | ||
test('copy with undefined prototype', t => { | ||
let o = Object.create(null); | ||
t.equal(o.__proto__, undefined, `o.__proto__ must be undefined`); | ||
t.throws(() => Object.create(o.__proto__), TypeError, `Object.create(o.__proto__) must throw TypeError`); | ||
t.equal(Object.getPrototypeOf(o), null, `Object.getPrototypeOf(o) must be null`); | ||
t.doesNotThrow(() => Object.create(Object.getPrototypeOf(o)), `Object.create(Object.getPrototypeOf(o)) must NOT throw an error`); | ||
t.doesNotThrow(() => Objects.copy(o), `copy(o)) must NOT throw an error`); | ||
t.end(); | ||
}); |
{ | ||
"name": "core-functions-tests", | ||
"version": "2.0.14", | ||
"version": "2.0.15", | ||
"author": "Byron du Preez", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -463,3 +463,9 @@ 'use strict'; | ||
// explicit avoidToJSONMethods must NOT use toJSON method | ||
checkWithArgs(task, false, true, false, wrapInString ? '[object Object]' : '{"name":"Task1","definition":{"name":"Task1","executable":true,"execute":[Function: anonymous],"subTaskDefs":[],"parent":undefined},"executable":true,"execute":[Function: anonymous],"_subTasks":[],"_subTasksByName":{},"parent":undefined,"_state":{"code":"Unstarted","completed":false,"error":undefined,"rejected":false,"reason":undefined},"_attempts":1,"_lastExecutedAt":"2016-12-01T05:09:09.119Z","_result":undefined,"_error":undefined,"_slaveTasks":[],"_frozen":true,"toJSON":[Function: toJSON]}'); | ||
if (process && process.version) { | ||
if (process.version.startsWith("4.3.")) { | ||
checkWithArgs(task, false, true, false, wrapInString ? '[object Object]' : '{"name":"Task1","definition":{"name":"Task1","executable":true,"execute":[Function: anonymous],"subTaskDefs":[],"parent":undefined},"executable":true,"execute":[Function: anonymous],"_subTasks":[],"_subTasksByName":{},"parent":undefined,"_state":{"code":"Unstarted","completed":false,"error":undefined,"rejected":false,"reason":undefined},"_attempts":1,"_began":"2016-12-01T05:09:09.119Z","_result":undefined,"_error":undefined,"_slaveTasks":[],"_frozen":true,"toJSON":[Function: toJSON]}'); | ||
} else if (process.version.startsWith("6.10.")) { | ||
checkWithArgs(task, false, true, false, wrapInString ? '[object Object]' : '{"name":"Task1","definition":{"name":"Task1","executable":true,"execute":[Function: execute],"subTaskDefs":[],"parent":undefined},"executable":true,"execute":[Function: execute],"_subTasks":[],"_subTasksByName":{},"parent":undefined,"_state":{"code":"Unstarted","completed":false,"error":undefined,"rejected":false,"reason":undefined},"_attempts":1,"_began":"2016-12-01T05:09:09.119Z","_result":undefined,"_error":undefined,"_slaveTasks":[],"_frozen":true,"toJSON":[Function: toJSON]}'); | ||
} | ||
} | ||
} | ||
@@ -466,0 +472,0 @@ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
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
4442
207
232306