core-functions
Advanced tools
+2
-2
| { | ||
| "name": "core-functions", | ||
| "version": "1.2.0", | ||
| "description": "Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including strings, functions, booleans, Promises, base 64, Arrays, Objects, standard AppErrors, etc.", | ||
| "version": "2.0.0", | ||
| "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.", | ||
| "author": "Byron du Preez", | ||
@@ -6,0 +6,0 @@ "license": "Apache-2.0", |
+7
-9
@@ -1,5 +0,5 @@ | ||
| # core-functions v1.2.0 | ||
| # core-functions v2.0.0 | ||
| Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including | ||
| strings, functions, booleans, Promises, base 64, Arrays, Objects, standard AppErrors, etc. | ||
| strings, booleans, Promises, base 64, Arrays, Objects, standard AppErrors, etc. | ||
@@ -11,3 +11,2 @@ Currently includes: | ||
| - booleans.js - boolean utilities | ||
| - functions.js - function utilities | ||
| - numbers.js - number utilities | ||
@@ -45,7 +44,2 @@ - objects.js - Object utilities | ||
| To use the function utilities | ||
| ```js | ||
| const Functions = require('core-functions/functions'); | ||
| ``` | ||
| To use the Base 64 encoding and decoding utilities | ||
@@ -131,2 +125,6 @@ ```js | ||
| - timers | ||
| - Added unit tests for existing and new functions and classes. | ||
| - Added unit tests for existing and new functions and classes. | ||
| ### 2.0.0 | ||
| - Removed unnecessary functions.js module | ||
| - Patches to testing.js `checkMethodEqual` and `checkMethodOkNotOk` functions to show method prefixes properly |
| { | ||
| "name": "core-functions-tests", | ||
| "version": "1.2.0", | ||
| "version": "2.0.0", | ||
| "author": "Byron du Preez", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
+6
-2
@@ -32,2 +32,6 @@ 'use strict'; | ||
| function toMethodArgsPrefix(obj, method, args) { | ||
| return prefixFnArgs ? `${obj.name ? obj.name : stringify(obj)}.${method.name ? method.name : '<anon>' }${stringify(args)} -> ` : ''; | ||
| } | ||
| function equal(t, actual, expected, prefix) { | ||
@@ -60,3 +64,3 @@ const msg = `${toPrefix(prefix)}${stringify(actual)} must be ${stringify(expected)}`; | ||
| // check if actual equals expected | ||
| equal(t, actual, expected, toFnArgsPrefix(method, args)); | ||
| equal(t, actual, expected, `${toMethodArgsPrefix(obj, method, args)}${toPrefix(prefix)}`); | ||
| } | ||
@@ -83,3 +87,3 @@ | ||
| // check if actual equals expected | ||
| okNotOk(t, actual, expected, okSuffix, notOkSuffix, `${toFnArgsPrefix(method, args)}${toPrefix(prefix)}`); | ||
| okNotOk(t, actual, expected, okSuffix, notOkSuffix, `${toMethodArgsPrefix(obj, method, args)}${toPrefix(prefix)}`); | ||
| } | ||
@@ -86,0 +90,0 @@ |
-31
| 'use strict'; | ||
| /** | ||
| * Utilities for working with functions. | ||
| * @module core-functions/functions | ||
| * @author Byron du Preez | ||
| */ | ||
| module.exports = { | ||
| /** Returns true if the given value is a function; false otherwise. */ | ||
| isFunction: isFunction, | ||
| /** A simple no-operation function. */ | ||
| noop: noop | ||
| }; | ||
| /** | ||
| * Returns true if the given value is a function; false otherwise. | ||
| * @param fn the "function" to test | ||
| * @returns {boolean} true if function; false if not | ||
| */ | ||
| function isFunction(fn) { | ||
| return typeof fn === 'function'; | ||
| } | ||
| /** | ||
| * A simple no-operation function. | ||
| * @returns {undefined} | ||
| */ | ||
| function noop() { | ||
| return undefined; | ||
| } | ||
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
0
-100%145367
-0.29%25
-3.85%2912
-0.82%127
-1.55%