Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

core-functions

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-functions - npm Package Compare versions

Comparing version 2.0.9 to 2.0.10

2

package.json
{
"name": "core-functions",
"version": "2.0.9",
"version": "2.0.10",
"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.9
# core-functions v2.0.10

@@ -107,2 +107,7 @@ Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including

### 2.0.10
- Changed `strings.js` module's `stringify` function:
- To surround errors, which are converted to strings via their `toString` methods, with square brackets (to indicate
that the property does not contain just a string error message)
### 2.0.9

@@ -109,0 +114,0 @@ - Patched and changed `strings.js` module's `stringify` function:

@@ -129,3 +129,3 @@ 'use strict';

const valueIsError = value instanceof Error;
if (valueIsError && useToStringForErrors) return `${value}`;
if (valueIsError && useToStringForErrors) return `[${value}]`;

@@ -132,0 +132,0 @@ // Special case for Functions - show them as [Function: {function name}]

{
"name": "core-functions-tests",
"version": "2.0.9",
"version": "2.0.10",
"author": "Byron du Preez",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -26,3 +26,3 @@ 'use strict';

const wrapped = wrap(value, wrapInString);
return wrapInString || value instanceof String ? `String(${value}) = (${wrapped ? wrapped.valueOf() : value}) ` : '';
return wrapInString || value instanceof String ? `String(${Strings.stringify(value, true, false, true)}) = [${Strings.stringify(wrapped ? wrapped.valueOf() : value, true, false, true)}] ` : '';
}

@@ -326,3 +326,3 @@

check(new Error('Planned error'), wrapInString ? 'Error: Planned error' : '{"name":"Error","message":"Planned error"}');
checkWithArgs(new Error('Planned error'), true, false, false, wrapInString ? 'Error: Planned error' : 'Error: Planned error');
checkWithArgs(new Error('Planned error'), true, false, false, wrapInString ? 'Error: Planned error' : '[Error: Planned error]');

@@ -329,0 +329,0 @@ // circular objects

@@ -29,11 +29,11 @@ 'use strict';

function toFnArgsPrefix(fn, args) {
return prefixFnArgs ? `${fn.name ? fn.name : '' }${stringify(args)} -> ` : '';
return prefixFnArgs ? `${fn.name ? fn.name : '' }${stringify(args, true, false, true)} -> ` : '';
}
function toMethodArgsPrefix(obj, method, args) {
return prefixFnArgs ? `${obj.name ? obj.name : stringify(obj)}.${method.name ? method.name : '<anon>' }${stringify(args)} -> ` : '';
return prefixFnArgs ? `${obj.name ? obj.name : stringify(obj, true, false, true)}.${method.name ? method.name : '<anon>' }${stringify(args, true, false, true)} -> ` : '';
}
function equal(t, actual, expected, prefix) {
const msg = `${toPrefix(prefix)}${stringify(actual)} must be ${stringify(expected)}`;
const msg = `${toPrefix(prefix)}${stringify(actual, true, false, true)} must be ${stringify(expected, true, false, true)}`;

@@ -93,8 +93,8 @@ if (Numbers.isNaN(actual)) {

obj[propertyName] = now;
t.fail(`${prefix ? prefix : ''}${stringify(obj)} ${propertyName} is supposed to be immutable`);
t.fail(`${prefix ? prefix : ''}${stringify(obj, true, false, true)} ${propertyName} is supposed to be immutable`);
} catch (err) {
// Expect an error on attempted mutation of immutable property
t.pass(`${prefix ? prefix : ''}${stringify(obj)} ${propertyName} is immutable`);
t.pass(`${prefix ? prefix : ''}${stringify(obj, true, false, true)} ${propertyName} is immutable`);
//console.log(`Expected error ${err}`);
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc