Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
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
1.2.0
to
2.0.0
+2
-2
package.json
{
"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",

@@ -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",

@@ -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 @@

'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;
}