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

@code-to-json/utils

Package Overview
Dependencies
Maintainers
2
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-to-json/utils - npm Package Compare versions

Comparing version 1.0.0-rc.10 to 1.0.0-rc.11

lib/src/errors/base.d.ts

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [1.0.0-rc.11](https://github.com/mike-north/code-to-json/compare/@code-to-json/utils@1.0.0-rc.10...@code-to-json/utils@1.0.0-rc.11) (2019-02-03)
### Features
* prune away unused util functions ([3b6c828](https://github.com/mike-north/code-to-json/commit/3b6c828))
# [1.0.0-rc.10](https://github.com/mike-north/code-to-json/compare/@code-to-json/utils@1.0.0-rc.9...@code-to-json/utils@1.0.0-rc.10) (2019-02-03)

@@ -8,0 +19,0 @@

@@ -5,2 +5,3 @@ /**

* @param predicate check to perform
* @public
*/

@@ -12,2 +13,3 @@ export declare function some<T>(target: T[], predicate: (val: T) => boolean): boolean;

* @param predicate check to perform
* @public
*/

@@ -18,2 +20,3 @@ export declare function all<T>(target: T[], predicate: (val: T) => boolean): boolean;

* @param value value to check
* @public
*/

@@ -26,5 +29,13 @@ export declare function isArray(value: any): value is any[];

* @param validator validator to apply to each member of the collection
* @public
*/
export declare function isHomogenousArray<T>(value: any[], validator: (v: any) => boolean): value is T[];
/**
* Invoke a callback for each member of an array
*
* @param array array to iterate over
* @param callback callback to invoke for each member of the array
* @public
*/
export declare function forEach<T>(array: T[] | ReadonlyArray<T> | undefined, callback: (item: T, idx: number) => void): void;
//# sourceMappingURL=array.d.ts.map

12

lib/src/array.js

@@ -7,2 +7,3 @@ "use strict";

* @param predicate check to perform
* @public
*/

@@ -22,2 +23,3 @@ function some(target, predicate) {

* @param predicate check to perform
* @public
*/

@@ -41,2 +43,3 @@ function all(target, predicate) {

* @param validator validator to apply to each member of the collection
* @public
*/

@@ -55,2 +58,9 @@ function isHomogenousArray(value, validator) {

exports.isHomogenousArray = isHomogenousArray;
/**
* Invoke a callback for each member of an array
*
* @param array array to iterate over
* @param callback callback to invoke for each member of the array
* @public
*/
function forEach(array, callback) {

@@ -63,2 +73,2 @@ if (!array) {

exports.forEach = forEach;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJyYXkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXJyYXkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7OztHQUlHO0FBQ0gsU0FBZ0IsSUFBSSxDQUFJLE1BQVcsRUFBRSxTQUE4QjtJQUNqRSxLQUFLLE1BQU0sQ0FBQyxJQUFJLE1BQU0sRUFBRTtRQUN0QixJQUFJLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRTtZQUN4QixPQUFPLElBQUksQ0FBQztTQUNiO0tBQ0Y7SUFDRCxPQUFPLEtBQUssQ0FBQztBQUNmLENBQUM7QUFQRCxvQkFPQztBQUVEOzs7O0dBSUc7QUFDSCxTQUFnQixHQUFHLENBQUksTUFBVyxFQUFFLFNBQThCO0lBQ2hFLEtBQUssTUFBTSxDQUFDLElBQUksTUFBTSxFQUFFO1FBQ3RCLElBQUksQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUU7WUFDekIsT0FBTyxLQUFLLENBQUM7U0FDZDtLQUNGO0lBQ0QsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBUEQsa0JBT0M7QUFRRCxTQUFnQixPQUFPLENBQUMsS0FBVTtJQUNoQyxPQUFPLEtBQUssWUFBWSxLQUFLLENBQUM7QUFDaEMsQ0FBQztBQUZELDBCQUVDO0FBRUQ7Ozs7R0FJRztBQUNILFNBQWdCLGlCQUFpQixDQUFJLEtBQVksRUFBRSxTQUE4QjtJQUMv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sSUFBSSxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRTtZQUN6QixPQUFPLEtBQUssQ0FBQztTQUNkO0tBQ0Y7SUFDRCxPQUFPLElBQUksQ0FBQztBQUNkLENBQUM7QUFQRCxrQkFPQztBQVNELFNBQWdCLE9BQU8sQ0FBQyxLQUFVO0lBQ2hDLE9BQU8sS0FBSyxZQUFZLEtBQUssQ0FBQztBQUNoQyxDQUFDO0FBRkQsMEJBRUM7QUFFRDs7Ozs7R0FLRztBQUNILFNBQWdCLGlCQUFpQixDQUFJLEtBQVksRUFBRSxTQUE4QjtJQUMvRSxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxFQUFFO1FBQ25CLE9BQU8sS0FBSyxDQUFDO0tBQ2Q7SUFDRCxLQUFLLE1BQU0sQ0FBQyxJQUFJLEtBQUssRUFBRTtRQUNyQixJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxFQUFFO1lBQ2pCLE9BQU8sS0FBSyxDQUFDO1NBQ2Q7S0FDRjtJQUNELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQztBQVZELDhDQVVDO0FBRUQ7Ozs7OztHQU1HO0FBQ0gsU0FBZ0IsT0FBTyxDQUNyQixLQUF5QyxFQUN6QyxRQUF3QztJQUV4QyxJQUFJLENBQUMsS0FBSyxFQUFFO1FBQ1YsT0FBTztLQUNSO0lBQ0EsS0FBSyxDQUFDLE9BQWUsQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUNuQyxDQUFDO0FBUkQsMEJBUUMifQ==

40

lib/src/checks.d.ts
/**
* Returns true if the passed value is null or undefined. This avoids errors
* from JSLint complaining about use of ==, which can be technically
* confusing.
* ```ts
* isNone(); // true
* isNone(null); // true
* isNone(undefined); // true
* isNone(''); // false
* isNone([]); // false
* isNone(function() {}); // false
* ```
* @note: copied from https://github.com/emberjs/ember.js/blob/5a8873bee19774a55fd0abfdcc7279f3efc768cd/packages/ember-metal/lib/is_none.ts#L25-L27
* Determine whether a value *isn't* undefined
* @param t the value to check
* @public
*/
export declare function isNone(obj: any): obj is null | undefined;
export declare function isDefined<T>(t: T | undefined): t is T;
/**
* Verifies that a value is null or undefined, an empty string, or an empty array.
* Constrains the rules on isNone by returning true for empty strings and empty arrays.
* If the value is an object with a size property of type number, it is used to check emptiness.
* @param obj
* Determine whether a value *isn't* null
* @param t the value to check
* @public
*/
export declare function isEmpty(obj: any): obj is null | undefined | 0 | {
size: 0;
} | [] | '';
/**
* Check a value for blankness
* @param obj value to check for blankness
* @see isPresent
*/
export declare function isBlank(obj: any): boolean;
/**
* Check a value for non-blankness
* @param obj object to check for presence
* @see isBlank
*/
export declare function isPresent(obj: any): boolean;
export declare function isDefined<T>(t: T | undefined): t is T;
export declare function isNotNull<T>(t: T | null): t is T;
//# sourceMappingURL=checks.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function get(obj, propname) {
if (obj && typeof obj === 'object') {
return obj[propname];
}
return undefined;
}
// i
/**
* Returns true if the passed value is null or undefined. This avoids errors
* from JSLint complaining about use of ==, which can be technically
* confusing.
* ```ts
* isNone(); // true
* isNone(null); // true
* isNone(undefined); // true
* isNone(''); // false
* isNone([]); // false
* isNone(function() {}); // false
* ```
* @note: copied from https://github.com/emberjs/ember.js/blob/5a8873bee19774a55fd0abfdcc7279f3efc768cd/packages/ember-metal/lib/is_none.ts#L25-L27
* Determine whether a value *isn't* undefined
* @param t the value to check
* @public
*/
function isNone(obj) {
return obj === null || obj === undefined;
}
exports.isNone = isNone;
/**
* Verifies that a value is null or undefined, an empty string, or an empty array.
* Constrains the rules on isNone by returning true for empty strings and empty arrays.
* If the value is an object with a size property of type number, it is used to check emptiness.
* @param obj
*/
function isEmpty(obj) {
const none = obj === null || obj === undefined;
if (none) {
return none;
}
if (typeof obj.size === 'number') {
return !obj.size;
}
const objectType = typeof obj;
if (objectType === 'object') {
const size = get(obj, 'size');
const length = get(obj, 'length');
if (typeof size === 'number') {
return !size;
}
if (typeof length === 'number') {
return !length;
}
}
if (typeof obj.length === 'number' && objectType !== 'function') {
return !obj.length;
}
return false;
}
exports.isEmpty = isEmpty;
/**
* Check a value for blankness
* @param obj value to check for blankness
* @see isPresent
*/
function isBlank(obj) {
return isEmpty(obj) || (typeof obj === 'string' && /\S/.test(obj) === false);
}
exports.isBlank = isBlank;
/**
* Check a value for non-blankness
* @param obj object to check for presence
* @see isBlank
*/
function isPresent(obj) {
return !isBlank(obj);
}
exports.isPresent = isPresent;
function isDefined(t) {

@@ -81,2 +12,7 @@ return typeof t !== 'undefined';

exports.isDefined = isDefined;
/**
* Determine whether a value *isn't* null
* @param t the value to check
* @public
*/
function isNotNull(t) {

@@ -86,2 +22,2 @@ return t !== null;

exports.isNotNull = isNotNull;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NoZWNrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQU9BLFNBQVMsR0FBRyxDQUFDLEdBQVEsRUFBRSxRQUFnQjtJQUNyQyxJQUFJLEdBQUcsSUFBSSxPQUFPLEdBQUcsS0FBSyxRQUFRLEVBQUU7UUFDbEMsT0FBTyxHQUFHLENBQUMsUUFBUSxDQUFDLENBQUM7S0FDdEI7SUFDRCxPQUFPLFNBQVMsQ0FBQztBQUNuQixDQUFDO0FBQ0QsSUFBSTtBQUNKOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCxTQUFnQixNQUFNLENBQUMsR0FBUTtJQUM3QixPQUFPLEdBQUcsS0FBSyxJQUFJLElBQUksR0FBRyxLQUFLLFNBQVMsQ0FBQztBQUMzQyxDQUFDO0FBRkQsd0JBRUM7QUFFRDs7Ozs7R0FLRztBQUNILFNBQWdCLE9BQU8sQ0FBQyxHQUFRO0lBQzlCLE1BQU0s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UFLLEtBQUssQ0FBQyxDQUFDO0FBQy9FLENBQUM7QUFGRCwwQkFFQztBQUNEOzs7O0dBSUc7QUFDSCxTQUFnQixTQUFTLENBQUMsR0FBUTtJQUNoQyxPQUFPLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ3ZCLENBQUM7QUFGRCw4QkFFQztBQUVELFNBQWdCLFNBQVMsQ0FBSSxDQUFnQjtJQUMzQyxPQUFPLE9BQU8sQ0FBQyxLQUFLLFdBQVcsQ0FBQztBQUNsQyxDQUFDO0FBRkQsOEJBRUM7QUFFRCxTQUFnQixTQUFTLENBQUksQ0FBVztJQUN0QyxPQUFPLENBQUMsS0FBSyxJQUFJLENBQUM7QUFDcEIsQ0FBQztBQUZELDhCQUVDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NoZWNrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOzs7O0dBSUc7QUFDSCxTQUFnQixTQUFTLENBQUksQ0FBZ0I7SUFDM0MsT0FBTyxPQUFPLENBQUMsS0FBSyxXQUFXLENBQUM7QUFDbEMsQ0FBQztBQUZELDhCQUVDO0FBRUQ7Ozs7R0FJRztBQUNILFNBQWdCLFNBQVMsQ0FBSSxDQUFXO0lBQ3RDLE9BQU8sQ0FBQyxLQUFLLElBQUksQ0FBQztBQUNwQixDQUFDO0FBRkQsOEJBRUMifQ==
import { ExtractPropertyNamesOfType } from '@mike-north/types';
/**
* Apply a simple caching layer to a unary method
*
* @param target class containing the method
* @param propertyKey name of method
* @param _descriptor property descriptor
* @public
*/
export declare function memoize<T, O extends object, K extends ExtractPropertyNamesOfType<O, (arg: any) => any>>(target: O, propertyKey: K, _descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
//# sourceMappingURL=decorators.d.ts.map

@@ -14,2 +14,10 @@ "use strict";

}
/**
* Apply a simple caching layer to a unary method
*
* @param target class containing the method
* @param propertyKey name of method
* @param _descriptor property descriptor
* @public
*/
function memoize(target, propertyKey, _descriptor) {

@@ -21,2 +29,2 @@ const original = target[propertyKey];

exports.memoize = memoize;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9ycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZWNvcmF0b3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsU0FBUyxjQUFjLENBQXNCLEVBQWlCO0lBQzVELE1BQU0sS0FBSyxHQUFHLElBQUksT0FBTyxFQUFRLENBQUM7SUFDbEMsT0FBTyxTQUFTLFVBQVUsQ0FBQyxHQUFNO1FBQy9CLElBQUksS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsRUFBRTtZQUNsQixPQUFPLEtBQUssQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFFLENBQUM7U0FDeEI7UUFDRCxNQUFNLE1BQU0sR0FBRyxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDdkIsS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDdkIsT0FBTyxNQUFNLENBQUM7SUFDaEIsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQUVELFNBQWdCLE9BQU8sQ0FLckIsTUFBUyxFQUNULFdBQWMsRUFDZCxXQUF1QztJQUV2QyxNQUFNLFFBQVEsR0FBRyxNQUFNLENBQUMsV0FBVyxDQUFDLENBQUM7SUFDckMsNkNBQTZDO0lBQzdDLE1BQU0sQ0FBQyxXQUFXLENBQUMsU0FBUyxDQUFDLFdBQVcsQ0FBQyxHQUFHLGNBQWMsQ0FBQyxRQUFlLENBQVEsQ0FBQztBQUNyRixDQUFDO0FBWkQsMEJBWUMifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9ycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZWNvcmF0b3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsU0FBUyxjQUFjLENBQXNCLEVBQWlCO0lBQzVELE1BQU0sS0FBSyxHQUFHLElBQUksT0FBTyxFQUFRLENBQUM7SUFDbEMsT0FBTyxTQUFTLFVBQVUsQ0FBQyxHQUFNO1FBQy9CLElBQUksS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsRUFBRTtZQUNsQixPQUFPLEtBQUssQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFFLENBQUM7U0FDeEI7UUFDRCxNQUFNLE1BQU0sR0FBRyxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDdkIsS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDdkIsT0FBTyxNQUFNLENBQUM7SUFDaEIsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQUVEOzs7Ozs7O0dBT0c7QUFDSCxTQUFnQixPQUFPLENBS3JCLE1BQVMsRUFDVCxXQUFjLEVBQ2QsV0FBdUM7SUFFdkMsTUFBTSxRQUFRLEdBQUcsTUFBTSxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBQ3JDLDZDQUE2QztJQUM3QyxNQUFNLENBQUMsV0FBVyxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsR0FBRyxjQUFjLENBQUMsUUFBZSxDQUFRLENBQUM7QUFDckYsQ0FBQztBQVpELDBCQVlDIn0=
import { Ref, RefTypes } from './ref';
/**
* A work queue
* @private
*/
export interface Queue<K, T extends object, OtherInfo> {

@@ -12,2 +16,10 @@ queue(item: T): Ref<K>;

}
/**
* Create a new work queue for a type of entity
*
* @param k the name of the entity type
* @param getIdInfo function used to generate id-data from an object
* @param extractId function used to extract an id from id-data
* @private
*/
export declare function createQueue<RefRegistry, K extends RefTypes<RefRegistry>, T extends object, IDInfo = string, OtherInfo = undefined>(k: K, getIdInfo: (t: T) => IDInfo, extractId?: (info: IDInfo) => {

@@ -14,0 +26,0 @@ id: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ref_1 = require("./ref");
/**
* Create a new work queue for a type of entity
*
* @param k the name of the entity type
* @param getIdInfo function used to generate id-data from an object
* @param extractId function used to extract an id from id-data
* @private
*/
function createQueue(k, getIdInfo, extractId = id => ({ id: id })) {

@@ -47,2 +55,2 @@ const itemToRef = new Map();

exports.createQueue = createQueue;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVldWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZGVmZXJyZWQtcHJvY2Vzc2luZy9xdWV1ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtCQUFpRDtBQWVqRCxTQUFnQixXQUFXLENBT3pCLENBQUksRUFDSixTQUEyQixFQUMzQixZQUFxRSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUMsRUFBRSxFQUFFLEVBQUUsRUFBUyxFQUFFLENBQUM7SUFFOUYsTUFBTSxTQUFTLEdBQUcsSUFBSSxHQUFHLEVBQStCLENBQUM7SUFDekQsT0FBTztRQUNMLEtBQUssQ0FBQyxJQUFPO1lBQ1gsTUFBTSxZQUFZLEdBQUcsU0FBUyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUN6QyxJQUFJLFlBQVksRUFBRTtnQkFDaEIsT0FBTyxZQUFZLENBQUMsR0FBRyxDQUFDO2FBQ3pCO1lBQ0QsTUFBTSxNQUFNLEdBQUcsU0FBUyxDQUFDLElBQUksQ0FBQyxDQUFDO1lBQy9CL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7b0JBQ2IsT0FBTztpQkFDUjtnQkFDRCxFQUFFLENBQUMsR0FBRyxFQUFFLEdBQUcsRUFBRSxTQUFTLENBQUMsQ0FBQztnQkFDeEIsNkNBQTZDO2dCQUM3QyxLQUFLLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQztnQkFDdkIsY0FBYyxFQUFFLENBQUM7WUFDbkIsQ0FBQyxDQUFDLENBQUM7WUFDSCxPQUFPLEVBQUUsY0FBYyxFQUFFLENBQUM7UUFDNUIsQ0FBQztRQUNELGVBQWUsQ0FBQyxFQUFrQztZQUNoRCxJQUFJLGNBQWMsR0FBRyxDQUFDLENBQUM7WUFDdkIsSUFBSSxFQUFFLGNBQWMsRUFBRSxLQUFLLEVBQUUsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQy9DLE9BQU8sS0FBSyxHQUFHLENBQUMsRUFBRTtnQkFDaEIsS0FBSyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLENBQUMsY0FBYyxDQUFDO2dCQUN0QyxjQUFjLElBQUksS0FBSyxDQUFDO2FBQ3pCO1lBQ0QsT0FBTyxFQUFFLGNBQWMsRUFBRSxDQUFDO1FBQzVCLENBQUM7S0FDRixDQUFDO0FBQ0osQ0FBQztBQXJERCxrQ0FxREMifQ==

@@ -0,4 +1,12 @@

/**
* The id value, within a reference
* @private
*/
export interface RefId<S> {
__do_not_use_this_refid: S;
}
/**
* The type value, within a reference
* @private
*/
export interface RefType<T> {

@@ -9,2 +17,3 @@ __do_not_use_this_reftype: T;

* A reference to an entity in a registry
* @public
*/

@@ -14,5 +23,14 @@ export declare type Ref<K, S extends {} = string> = [RefType<K>, RefId<S>];

* Get a reference type for a registry
* @public
*/
export declare type RefFor<RefRegistry, K extends keyof RefRegistry> = RefRegistry[K];
/**
* Get the names of types present in a RefRegistry
* @public
*/
export declare type RefTypes<RefRegistry> = keyof RefRegistry;
/**
* Any reference possible for a given RefRegistry
* @public
*/
export declare type AnyRef<RefRegistry> = RefRegistry[RefTypes<RefRegistry>];

@@ -22,2 +40,3 @@ /**

* @param thing value to check
* @public
*/

@@ -31,2 +50,3 @@ export declare function isRef<R extends Ref<any>>(thing?: R): thing is R;

* @returns the new reference
* @public
*/

@@ -37,2 +57,3 @@ export declare function createRef<RefRegistry, K extends RefTypes<RefRegistry>>(type: K, id: string): Ref<K>;

* @param ref the reference
* @public
*/

@@ -43,5 +64,10 @@ export declare function refType<K>(ref: Ref<K, any>): K;

* @param ref the reference
* @public
*/
export declare function refId<S extends {}>(ref: Ref<any, S>): S;
/**
* A function that turns a reference into a resolved entity
* @public
*/
export declare type RefResolver<EntityMap> = <K extends keyof EntityMap>(ref?: Ref<K>) => EntityMap[K] | undefined;
//# sourceMappingURL=ref.d.ts.map

@@ -17,2 +17,3 @@ "use strict";

* @returns the new reference
* @public
*/

@@ -26,2 +27,3 @@ function createRef(type, id) {

* @param ref the reference
* @public
*/

@@ -35,2 +37,3 @@ function refType(ref) {

* @param ref the reference
* @public
*/

@@ -41,2 +44,2 @@ function refId(ref) {

exports.refId = refId;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVmLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2RlZmVycmVkLXByb2Nlc3NpbmcvcmVmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsb0NBQW1DO0FBNEJuQyxTQUFnQixLQUFLLENBQXFCLEtBQVM7SUFDakQsT0FBTyxDQUNMLENBQUMsQ0FBQyxLQUFLO1FBQ1AsQ0FBQyxDQUFDLGVBQU8sQ0FBQyxLQUFLLENBQUM7UUFDaEIsS0FBSyxDQUFDLE1BQU0sS0FBSyxDQUFDO1FBQ2xCLE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVE7UUFDNUIsT0FBTyxLQUFLLENBQUM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BZ0IsU0FBUyxDQUN2QixJQUFPLEVBQ1AsRUFBVTtJQUVWLE9BQU8sQ0FBRSxJQUEwQixFQUFFLEVBQVMsQ0FBQyxDQUFDO0FBQ2xELENBQUM7QUFMRCw4QkFLQztBQUVEOzs7O0dBSUc7QUFDSCxTQUFnQixPQUFPLENBQUksR0FBZ0I7SUFDekMsT0FBTyxHQUFHLENBQUMsQ0FBQyxDQUFRLENBQUM7QUFDdkIsQ0FBQztBQUZELDBCQUVDO0FBRUQ7Ozs7R0FJRztBQUNILFNBQWdCLEtBQUssQ0FBZSxHQUFnQjtJQUNsRCxPQUFPLEdBQUcsQ0FBQyxDQUFDLENBQVEsQ0FBQztBQUN2QixDQUFDO0FBRkQsc0JBRUMifQ==

@@ -0,11 +1,12 @@

import BaseError from './base';
/**
* Throw an error describing invalid arguments passed to the CLI
*/
export default class InvalidArgumentsError extends Error {
export default class InvalidArgumentsError extends BaseError<'invalidArguments'> {
/**
* Invalid arguments brand
*/
readonly __invalid_arguments_error = true;
readonly kind = "invalidArguments";
constructor(msg: string);
}
//# sourceMappingURL=invalid-arguments.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("./base");
/**
* Throw an error describing invalid arguments passed to the CLI
*/
class InvalidArgumentsError extends Error {
class InvalidArgumentsError extends base_1.default {
constructor(msg) {

@@ -12,7 +13,6 @@ super(`[Invalid arguments] ${msg}`);

*/
// tslint:disable-next-line:variable-name
this.__invalid_arguments_error = true;
this.kind = 'invalidArguments';
}
}
exports.default = InvalidArgumentsError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW52YWxpZC1hcmd1bWVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZXJyb3JzL2ludmFsaWQtYXJndW1lbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7O0dBRUc7QUFDSCxNQUFxQixxQkFBc0IsU0FBUSxLQUFLO0lBT3RELFlBQVksR0FBVztRQUNyQixLQUFLLENBQUMsdUJBQXVCLEdBQUcsRUFBRSxDQUFDLENBQUM7UUFQdEM7O1dBRUc7UUFDSCx5Q0FBeUM7UUFDekIsOEJBQXlCLEdBQUcsSUFBSSxDQUFDO0lBSWpELENBQUM7Q0FDRjtBQVZELHdDQVVDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW52YWxpZC1hcmd1bWVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZXJyb3JzL2ludmFsaWQtYXJndW1lbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaUNBQStCO0FBRS9COztHQUVHO0FBQ0gsTUFBcUIscUJBQXNCLFNBQVEsY0FBNkI7SUFLOUUsWUFBWSxHQUFXO1FBQ3JCLEtBQUssQ0FBQyx1QkFBdUIsR0FBRyxFQUFFLENBQUMsQ0FBQztRQUx0Qzs7V0FFRztRQUNhLFNBQUksR0FBRyxrQkFBa0IsQ0FBQztJQUcxQyxDQUFDO0NBQ0Y7QUFSRCx3Q0FRQyJ9

@@ -0,5 +1,9 @@

import BaseError from './base';
/**
* An error that's associated with un-reachable code
*
* @public
*/
declare class UnreachableError extends Error {
declare class UnreachableError extends BaseError<'unreachable'> {
readonly kind = "unreachable";
constructor(_arg: never, message?: string);

@@ -6,0 +10,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("./base");
const BASE_MESSAGE = 'Reached code that should be unreachable';

@@ -17,9 +18,12 @@ /**

* An error that's associated with un-reachable code
*
* @public
*/
class UnreachableError extends Error {
class UnreachableError extends base_1.default {
constructor(_arg, message) {
super(createMessage(message));
this.kind = 'unreachable';
}
}
exports.default = UnreachableError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5yZWFj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BQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0tBQ2pCO0lBQ0QsT0FBTyxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO0FBQ3RCLENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsTUFBTSxnQkFBaUIsU0FBUSxjQUF3QjtJQUVyRCxZQUFZLElBQVcsRUFBRSxPQUFnQjtRQUN2QyxLQUFLLENBQUMsYUFBYSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7UUFGaEIsU0FBSSxHQUFHLGFBQWEsQ0FBQztJQUdyQyxDQUFDO0NBQ0Y7QUFFRCxrQkFBZSxnQkFBZ0IsQ0FBQyJ9
export { default as UnreachableError } from './errors/unreachable';
export { default as InvalidArgumentsError } from './errors/invalid-arguments';
export { some, all, isArray, forEach } from './array';
export { Result, ErrorResult, SuccessResult, TextFileReader, FileExistenceChecker } from './types';
export { isBlank, isPresent, isEmpty, isNone, isDefined, isNotNull } from './checks';
export { isDefined, isNotNull } from './checks';
export { createQueue, Queue } from './deferred-processing/queue';

@@ -7,0 +6,0 @@ export { Ref, RefFor, AnyRef, refType, refId, isRef, createRef, RefResolver, } from './deferred-processing/ref';

@@ -13,6 +13,2 @@ "use strict";

var checks_1 = require("./checks");
exports.isBlank = checks_1.isBlank;
exports.isPresent = checks_1.isPresent;
exports.isEmpty = checks_1.isEmpty;
exports.isNone = checks_1.isNone;
exports.isDefined = checks_1.isDefined;

@@ -33,2 +29,2 @@ exports.isNotNull = checks_1.isNotNull;

exports.memoize = decorators_1.memoize;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxvREFBbUU7QUFBMUQseUNBQUEsT0FBTyxDQUFvQjtBQUNwQyxnRUFBOE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QUEsT0FBTyxDQUFBO0FBQ3BDLG1DQUFnRDtBQUF2Qyw2QkFBQSxTQUFTLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFDN0IscURBQWlFO0FBQXhELDhCQUFBLFdBQVcsQ0FBQTtBQUNwQixpREFTbUM7QUFMakMsd0JBQUEsT0FBTyxDQUFBO0FBQ1Asc0JBQUEsS0FBSyxDQUFBO0FBQ0wsc0JBQUEsS0FBSyxDQUFBO0FBQ0wsMEJBQUEsU0FBUyxDQUFBO0FBR1gscUNBQW9DO0FBQTNCLDRCQUFBLE9BQU8sQ0FBQTtBQUNoQixtQ0FBeUQ7QUFBaEQsaURBQUEsNkJBQTZCLENBQUE7QUFDdEMsMkNBQXVDO0FBQTlCLCtCQUFBLE9BQU8sQ0FBQSJ9

@@ -0,2 +1,14 @@

/**
* Transform a value, and place it on an object under a specified property key,
* if a prescribed condition is met
*
* @param host the object on which the transformed property may be placed
* @param property the property to potentially transform
* @param propertyName the property key of `host` where the transformed data may be placed
* @param transform the transformation function
* @param condition the condition
*
* @public
*/
export declare function conditionallyMergeTransformed<H extends {}, B, A extends H[K], K extends keyof H>(host: H, property: B | undefined, propertyName: K, transform: (b: B) => A, condition?: (prop: B) => boolean): void;
//# sourceMappingURL=object.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Transform a value, and place it on an object under a specified property key,
* if a prescribed condition is met
*
* @param host the object on which the transformed property may be placed
* @param property the property to potentially transform
* @param propertyName the property key of `host` where the transformed data may be placed
* @param transform the transformation function
* @param condition the condition
*
* @public
*/
function conditionallyMergeTransformed(host, property, propertyName, transform, condition) {

@@ -10,2 +22,2 @@ if (property && (condition ? condition(property) : true)) {

exports.conditionallyMergeTransformed = conditionallyMergeTransformed;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2JqZWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL29iamVjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLFNBQWdCLDZCQUE2QixDQUMzQyxJQUFPLEVBQ1AsUUFBdUIsRUFDdkIsWUFBZSxFQUNmLFNBQXNCLEVBQ3RCLFNBQWdDO0lBRWhDLElBQUksUUFBUSxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxFQUFFO1FBQ3hELDZDQUE2QztRQUM3QyxJQUFJLENBQUMsWUFBWSxDQUFDLEdBQUcsU0FBUyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0tBQzFDO0FBQ0gsQ0FBQztBQVhELHNFQVdDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2JqZWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL29iamVjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7Ozs7OztHQVdHO0FBQ0gsU0FBZ0IsNkJBQTZCLENBQzNDLElBQU8sRUFDUCxRQUF1QixFQUN2QixZQUFlLEVBQ2YsU0FBc0IsRUFDdEIsU0FBZ0M7SUFFaEMsSUFBSSxRQUFRLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDeEQsNkNBQTZDO1FBQzdDLElBQUksQ0FBQyxZQUFZLENBQUMsR0FBRyxTQUFTLENBQUMsUUFBUSxDQUFDLENBQUM7S0FDMUM7QUFDSCxDQUFDO0FBWEQsc0VBV0MifQ==

@@ -1,2 +0,7 @@

declare type UnaryFunction<Arg, Ret> = (a: Arg) => Ret;
import { UnaryFunction } from './types';
/**
* Create a pipeline of unary functions
*
* @public
*/
export declare function pipe(): <T>(x: T) => T;

@@ -8,3 +13,2 @@ export declare function pipe<A, R>(f1: UnaryFunction<A, R>): (a: A) => R;

export declare function pipe<A1, R1, R2, R3, R4, R5>(f1: UnaryFunction<A1, R1>, f2: UnaryFunction<R1, R2>, f3: UnaryFunction<R2, R3>, f4: UnaryFunction<R3, R4>, f5: UnaryFunction<R4, R5>): (a: A1) => R5;
export {};
//# sourceMappingURL=pipe.d.ts.map

@@ -7,2 +7,2 @@ "use strict";

exports.pipe = pipe;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBMkJBLFNBQWdCLElBQUksQ0FBQyxHQUFHLEdBQTZCO0lBQ25ELE9BQU8sR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0FBQ2xELENBQUM7QUFGRCxvQkFFQyJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBZ0NBLFNBQWdCLElBQUksQ0FBQyxHQUFHLEdBQTZCO0lBQ25ELE9BQU8sR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0FBQ2xELENBQUM7QUFGRCxvQkFFQyJ9
/**
* Create a promise that resolves after some amount of time
* @param n number of milliseconds to wait before resolving promise
*
* @param n number of milliseconds to wait
* @public
*/
export declare function timeout(n: number): Promise<void>;
//# sourceMappingURL=promise.d.ts.map

@@ -5,3 +5,5 @@ "use strict";

* Create a promise that resolves after some amount of time
* @param n number of milliseconds to wait before resolving promise
*
* @param n number of milliseconds to wait
* @public
*/

@@ -14,2 +16,2 @@ function timeout(n) {

exports.timeout = timeout;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvbWlzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm9taXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7OztHQUdHO0FBQ0gsU0FBZ0IsT0FBTyxDQUFDLENBQVM7SUFDL0IsT0FBTyxJQUFJLE9BQU8sQ0FBTyxPQUFPLENBQUMsRUFBRTtRQUNqQyxVQUFVLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQyxDQUFDO0lBQ3pCLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUpELDBCQUlDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvbWlzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm9taXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7O0dBS0c7QUFDSCxTQUFnQixPQUFPLENBQUMsQ0FBUztJQUMvQixPQUFPLElBQUksT0FBTyxDQUFPLE9BQU8sQ0FBQyxFQUFFO1FBQ2pDLFVBQVUsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDLENBQUM7SUFDekIsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDO0FBSkQsMEJBSUMifQ==

@@ -1,6 +0,7 @@

export declare type ErrorResult<E extends Error = Error> = ['error', E];
export declare type SuccessResult<T> = ['ok', T];
export declare type Result<T, E extends Error = Error> = SuccessResult<T> | ErrorResult<E>;
export declare type TextFileReader = (name: string) => string;
export declare type FileExistenceChecker = (name: string) => boolean;
/**
* A function that takes a single argument
*
* @public
*/
export declare type UnaryFunction<Arg, Ret> = (a: Arg) => Ret;
//# sourceMappingURL=types.d.ts.map
{
"name": "@code-to-json/utils",
"version": "1.0.0-rc.10",
"version": "1.0.0-rc.11",
"description": "Low-level utilities for code-to-json",

@@ -96,3 +96,3 @@ "main": "lib/src/index.js",

},
"gitHead": "8d2bf8bd3826cf3ccea361a318ff75f7160495db"
"gitHead": "2a8ee13720b29edda6dca69e4559864f4687f4de"
}

@@ -5,2 +5,3 @@ /**

* @param predicate check to perform
* @public
*/

@@ -20,2 +21,3 @@ export function some<T>(target: T[], predicate: (val: T) => boolean): boolean {

* @param predicate check to perform
* @public
*/

@@ -34,2 +36,3 @@ export function all<T>(target: T[], predicate: (val: T) => boolean): boolean {

* @param value value to check
* @public
*/

@@ -46,2 +49,3 @@ export function isArray(value: any): value is any[];

* @param validator validator to apply to each member of the collection
* @public
*/

@@ -60,2 +64,9 @@ export function isHomogenousArray<T>(value: any[], validator: (v: any) => boolean): value is T[] {

/**
* Invoke a callback for each member of an array
*
* @param array array to iterate over
* @param callback callback to invoke for each member of the array
* @public
*/
export function forEach<T>(

@@ -62,0 +73,0 @@ array: T[] | ReadonlyArray<T> | undefined,

/**
* Get a property from a target object
* @param obj target
* @param propname property name
* Determine whether a value *isn't* undefined
* @param t the value to check
* @public
*/
function get<O extends object, K extends keyof O>(obj: O, propname: K): O[K];
function get(obj: any, propname: string): any;
function get(obj: any, propname: string): any {
if (obj && typeof obj === 'object') {
return obj[propname];
}
return undefined;
export function isDefined<T>(t: T | undefined): t is T {
return typeof t !== 'undefined';
}
// i
/**
* Returns true if the passed value is null or undefined. This avoids errors
* from JSLint complaining about use of ==, which can be technically
* confusing.
* ```ts
* isNone(); // true
* isNone(null); // true
* isNone(undefined); // true
* isNone(''); // false
* isNone([]); // false
* isNone(function() {}); // false
* ```
* @note: copied from https://github.com/emberjs/ember.js/blob/5a8873bee19774a55fd0abfdcc7279f3efc768cd/packages/ember-metal/lib/is_none.ts#L25-L27
*/
export function isNone(obj: any): obj is null | undefined {
return obj === null || obj === undefined;
}
/**
* Verifies that a value is null or undefined, an empty string, or an empty array.
* Constrains the rules on isNone by returning true for empty strings and empty arrays.
* If the value is an object with a size property of type number, it is used to check emptiness.
* @param obj
* Determine whether a value *isn't* null
* @param t the value to check
* @public
*/
export function isEmpty(obj: any): obj is null | undefined | 0 | { size: 0 } | [] | '' {
const none = obj === null || obj === undefined;
if (none) {
return none;
}
if (typeof obj.size === 'number') {
return !obj.size;
}
const objectType = typeof obj;
if (objectType === 'object') {
const size = get(obj, 'size');
const length = get(obj, 'length');
if (typeof size === 'number') {
return !size;
}
if (typeof length === 'number') {
return !length;
}
}
if (typeof obj.length === 'number' && objectType !== 'function') {
return !obj.length;
}
return false;
}
/**
* Check a value for blankness
* @param obj value to check for blankness
* @see isPresent
*/
export function isBlank(obj: any): boolean {
return isEmpty(obj) || (typeof obj === 'string' && /\S/.test(obj) === false);
}
/**
* Check a value for non-blankness
* @param obj object to check for presence
* @see isBlank
*/
export function isPresent(obj: any): boolean {
return !isBlank(obj);
}
export function isDefined<T>(t: T | undefined): t is T {
return typeof t !== 'undefined';
}
export function isNotNull<T>(t: T | null): t is T {
return t !== null;
}

@@ -15,2 +15,10 @@ import { ExtractPropertyNamesOfType } from '@mike-north/types';

/**
* Apply a simple caching layer to a unary method
*
* @param target class containing the method
* @param propertyKey name of method
* @param _descriptor property descriptor
* @public
*/
export function memoize<

@@ -17,0 +25,0 @@ T,

import { createRef, Ref, RefTypes } from './ref';
/**
* @internal
*/
interface EntityInfo<K, O> {
/** reference */
ref: Ref<K>;
/** additional information */
otherInfo?: O;
/** whether this entity has been processed or not */
processed: boolean;
}
/**
* A work queue
* @private
*/
export interface Queue<K, T extends object, OtherInfo> {

@@ -16,2 +26,10 @@ queue(item: T): Ref<K>;

/**
* Create a new work queue for a type of entity
*
* @param k the name of the entity type
* @param getIdInfo function used to generate id-data from an object
* @param extractId function used to extract an id from id-data
* @private
*/
export function createQueue<

@@ -18,0 +36,0 @@ RefRegistry,

import { isArray } from '../array';
/**
* The id value, within a reference
* @private
*/
export interface RefId<S> {
__do_not_use_this_refid: S;
}
/**
* The type value, within a reference
* @private
*/
export interface RefType<T> {

@@ -12,2 +21,3 @@ __do_not_use_this_reftype: T;

* A reference to an entity in a registry
* @public
*/

@@ -18,6 +28,16 @@ export type Ref<K, S extends {} = string> = [RefType<K>, RefId<S>];

* Get a reference type for a registry
* @public
*/
export type RefFor<RefRegistry, K extends keyof RefRegistry> = RefRegistry[K];
/**
* Get the names of types present in a RefRegistry
* @public
*/
export type RefTypes<RefRegistry> = keyof RefRegistry;
/**
* Any reference possible for a given RefRegistry
* @public
*/
export type AnyRef<RefRegistry> = RefRegistry[RefTypes<RefRegistry>];

@@ -28,2 +48,3 @@

* @param thing value to check
* @public
*/

@@ -47,2 +68,3 @@ export function isRef<R extends Ref<any>>(thing?: R): thing is R;

* @returns the new reference
* @public
*/

@@ -59,2 +81,3 @@ export function createRef<RefRegistry, K extends RefTypes<RefRegistry>>(

* @param ref the reference
* @public
*/

@@ -68,2 +91,3 @@ export function refType<K>(ref: Ref<K, any>): K {

* @param ref the reference
* @public
*/

@@ -74,4 +98,8 @@ export function refId<S extends {}>(ref: Ref<any, S>): S {

/**
* A function that turns a reference into a resolved entity
* @public
*/
export type RefResolver<EntityMap> = <K extends keyof EntityMap>(
ref?: Ref<K>,
) => EntityMap[K] | undefined;

@@ -0,11 +1,11 @@

import BaseError from './base';
/**
* Throw an error describing invalid arguments passed to the CLI
*/
export default class InvalidArgumentsError extends Error {
export default class InvalidArgumentsError extends BaseError<'invalidArguments'> {
/**
* Invalid arguments brand
*/
// tslint:disable-next-line:variable-name
public readonly __invalid_arguments_error = true;
public readonly kind = 'invalidArguments';
constructor(msg: string) {

@@ -12,0 +12,0 @@ super(`[Invalid arguments] ${msg}`);

@@ -0,1 +1,3 @@

import BaseError from './base';
const BASE_MESSAGE = 'Reached code that should be unreachable';

@@ -17,4 +19,7 @@

* An error that's associated with un-reachable code
*
* @public
*/
class UnreachableError extends Error {
class UnreachableError extends BaseError<'unreachable'> {
public readonly kind = 'unreachable';
constructor(_arg: never, message?: string) {

@@ -21,0 +26,0 @@ super(createMessage(message));

export { default as UnreachableError } from './errors/unreachable';
export { default as InvalidArgumentsError } from './errors/invalid-arguments';
export { some, all, isArray, forEach } from './array';
export { Result, ErrorResult, SuccessResult, TextFileReader, FileExistenceChecker } from './types';
export { isBlank, isPresent, isEmpty, isNone, isDefined, isNotNull } from './checks';
export { isDefined, isNotNull } from './checks';
export { createQueue, Queue } from './deferred-processing/queue';

@@ -7,0 +6,0 @@ export {

@@ -0,1 +1,13 @@

/**
* Transform a value, and place it on an object under a specified property key,
* if a prescribed condition is met
*
* @param host the object on which the transformed property may be placed
* @param property the property to potentially transform
* @param propertyName the property key of `host` where the transformed data may be placed
* @param transform the transformation function
* @param condition the condition
*
* @public
*/
export function conditionallyMergeTransformed<H extends {}, B, A extends H[K], K extends keyof H>(

@@ -2,0 +14,0 @@ host: H,

@@ -1,3 +0,8 @@

type UnaryFunction<Arg, Ret> = (a: Arg) => Ret;
import { UnaryFunction } from './types';
/**
* Create a pipeline of unary functions
*
* @public
*/
export function pipe(): <T>(x: T) => T;

@@ -4,0 +9,0 @@ export function pipe<A, R>(f1: UnaryFunction<A, R>): (a: A) => R;

/**
* Create a promise that resolves after some amount of time
* @param n number of milliseconds to wait before resolving promise
*
* @param n number of milliseconds to wait
* @public
*/

@@ -5,0 +7,0 @@ export function timeout(n: number): Promise<void> {

@@ -1,5 +0,6 @@

export type ErrorResult<E extends Error = Error> = ['error', E];
export type SuccessResult<T> = ['ok', T];
export type Result<T, E extends Error = Error> = SuccessResult<T> | ErrorResult<E>;
export type TextFileReader = (name: string) => string;
export type FileExistenceChecker = (name: string) => boolean;
/**
* A function that takes a single argument
*
* @public
*/
export type UnaryFunction<Arg, Ret> = (a: Arg) => Ret;
import { expect } from 'chai';
import { suite, test } from 'mocha-typescript';
import { isBlank, isDefined, isEmpty, isNone, isNotNull, isPresent } from '../src/checks';
import { isDefined, isNotNull } from '../src/checks';

@@ -8,15 +8,2 @@ @suite('Simple predicates')

@test
public 'isEmpty tests'(): void {
expect(isEmpty(0)).to.eql(false);
expect(isEmpty(null)).to.eql(true);
expect(isEmpty([])).to.eql(true);
expect(isEmpty({ size: 0 })).to.eql(true);
expect(isEmpty({ size: 33 })).to.eql(false);
expect(isEmpty({ length: 0 })).to.eql(true);
expect(isEmpty({ length: 33 })).to.eql(false);
expect(isEmpty(() => ({}))).to.eql(false);
expect(isEmpty(new Map([['a', 1]]))).to.eql(false);
}
@test
public 'isNotNull tests'(): void {

@@ -48,41 +35,2 @@ expect(isNotNull(0)).to.eql(true);

}
@test
public 'isNone tests'(): void {
expect(isNone(0)).to.eql(false);
expect(isNone(null)).to.eql(true);
expect(isNone([])).to.eql(false);
expect(isNone({ size: 0 })).to.eql(false);
expect(isNone({ size: 33 })).to.eql(false);
expect(isNone({ length: 0 })).to.eql(false);
expect(isNone({ length: 33 })).to.eql(false);
expect(isNone(() => ({}))).to.eql(false);
expect(isNone(new Map([['a', 1]]))).to.eql(false);
}
@test
public 'isBlank tests'(): void {
expect(isBlank(0)).to.eql(false);
expect(isBlank(null)).to.eql(true);
expect(isBlank([])).to.eql(true);
expect(isBlank({ size: 0 })).to.eql(true);
expect(isBlank({ size: 33 })).to.eql(false);
expect(isBlank({ length: 0 })).to.eql(true);
expect(isBlank({ length: 33 })).to.eql(false);
expect(isBlank(() => ({}))).to.eql(false);
expect(isBlank(new Map([['a', 1]]))).to.eql(false);
}
@test
public 'isPresent tests'(): void {
expect(isPresent(0)).to.eql(true);
expect(isPresent(null)).to.eql(false);
expect(isPresent([])).to.eql(false);
expect(isPresent({ size: 0 })).to.eql(false);
expect(isPresent({ size: 33 })).to.eql(true);
expect(isPresent({ length: 0 })).to.eql(false);
expect(isPresent({ length: 33 })).to.eql(true);
expect(isPresent(() => ({}))).to.eql(true);
expect(isPresent(new Map([['a', 1]]))).to.eql(true);
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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