@code-to-json/utils
Advanced tools
Comparing version 1.0.0-rc.7 to 1.0.0-rc.8
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.0.0-rc.8](https://github.com/mike-north/code-to-json/compare/@code-to-json/utils@1.0.0-rc.7...@code-to-json/utils@1.0.0-rc.8) (2019-01-30) | ||
### Features | ||
* **utils:** introduce concept of RefResolver ([26cc062](https://github.com/mike-north/code-to-json/commit/26cc062)) | ||
# [1.0.0-rc.7](https://github.com/mike-north/code-to-json/compare/@code-to-json/utils@1.0.0-rc.6...@code-to-json/utils@1.0.0-rc.7) (2019-01-29) | ||
@@ -8,0 +19,0 @@ |
@@ -22,2 +22,3 @@ export interface RefId<S> { | ||
export declare function isRef<R extends Ref<any>>(thing?: R): thing is R; | ||
export declare function isRef<K extends string>(thing: any, refType: K): thing is Ref<K>; | ||
/** | ||
@@ -34,3 +35,3 @@ * Create a new reference | ||
*/ | ||
export declare function refType<K extends string>(ref: Ref<K, any>): K; | ||
export declare function refType<K>(ref: Ref<K, any>): K; | ||
/** | ||
@@ -41,2 +42,3 @@ * Get a reference's ID | ||
export declare function refId<S extends {}>(ref: Ref<any, S>): S; | ||
export declare type RefResolver<EntityMap> = <K extends keyof EntityMap>(ref?: Ref<K>) => EntityMap[K] | undefined; | ||
//# sourceMappingURL=ref.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const array_1 = require("../array"); | ||
/** | ||
* Check to see whether a value is a reference | ||
* @param thing value to check | ||
*/ | ||
function isRef(thing) { | ||
@@ -42,2 +38,2 @@ return (!!thing && | ||
exports.refId = refId; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVmLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2RlZmVycmVkLXByb2Nlc3NpbmcvcmVmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsb0NBQW1DO0FBc0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0FBQyxDQUFDLGVBQU8sQ0FBQyxLQUFLLENBQUM7UUFDaEIsS0FBSyxDQUFDLE1BQU0sS0FBSyxDQUFDO1FBQ2xCLE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVE7UUFDNUIsT0FBTyxLQUFLLENBQUMsQ0FBQyxDQUFDLEtBQUssUUFBUSxDQUM3QixDQUFDO0FBQ0osQ0FBQztBQVJELHNCQVFDO0FBRUQ7Ozs7O0dBS0c7QUFDSCxTQUFnQixTQUFTLENBQ3ZCLElBQU8sRUFDUCxFQUFVO0lBRVYsT0FBTyxDQUFFLElBQTBCLEVBQUUsRUFBUyxDQUFDLENBQUM7QUFDbEQsQ0FBQztBQUxELDhCQUtDO0FBRUQ7OztHQUdHO0FBQ0gsU0FBZ0IsT0FBTyxDQUFJLEdBQWdCO0lBQ3pDLE9BQU8sR0FBRyxDQUFDLENBQUMsQ0FBUSxDQUFDO0FBQ3ZCLENBQUM7QUFGRCwwQkFFQztBQUVEOzs7R0FHRztBQUNILFNBQWdCLEtBQUssQ0FBZSxHQUFnQjtJQUNsRCxPQUFPLEdBQUcsQ0FBQyxDQUFDLENBQVEsQ0FBQztBQUN2QixDQUFDO0FBRkQsc0JBRUMifQ== |
@@ -7,5 +7,5 @@ export { default as UnreachableError } from './errors/unreachable'; | ||
export { createQueue, Queue } from './deferred-processing/queue'; | ||
export { Ref, RefFor, AnyRef, refType, refId, isRef, createRef } from './deferred-processing/ref'; | ||
export { Ref, RefFor, AnyRef, refType, refId, isRef, createRef, RefResolver, } from './deferred-processing/ref'; | ||
export { timeout } from './promise'; | ||
export { conditionallyMergeTransformed } from './object'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -30,2 +30,2 @@ "use strict"; | ||
exports.conditionallyMergeTransformed = object_1.conditionallyMergeTransformed; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291c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SUFBSSxDQUFBO0FBQUUsc0JBQUEsR0FBRyxDQUFBO0FBQUUsMEJBQUEsT0FBTyxDQUFBO0FBQUUsMEJBQUEsT0FBTyxDQUFBO0FBRXBDLG1DQUFxRjtBQUE1RSwyQkFBQSxPQUFPLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFBRSwyQkFBQSxPQUFPLENBQUE7QUFBRSwwQkFBQSxNQUFNLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFDbEUscURBQWlFO0FBQXhELDhCQUFBLFdBQVcsQ0FBQTtBQUNwQixpREFTbUM7QUFMakMsd0JBQUEsT0FBTyxDQUFBO0FBQ1Asc0JBQUEsS0FBSyxDQUFBO0FBQ0wsc0JBQUEsS0FBSyxDQUFBO0FBQ0wsMEJBQUEsU0FBUyxDQUFBO0FBR1gscUNBQW9DO0FBQTNCLDRCQUFBLE9BQU8sQ0FBQTtBQUNoQixtQ0FBeUQ7QUFBaEQsaURBQUEsNkJBQTZCLENBQUEifQ== |
{ | ||
"name": "@code-to-json/utils", | ||
"version": "1.0.0-rc.7", | ||
"version": "1.0.0-rc.8", | ||
"description": "Low-level utilities for code-to-json", | ||
@@ -96,3 +96,3 @@ "main": "lib/src/index.js", | ||
}, | ||
"gitHead": "fdc2ee0611f5199a0dbfcde47675c3664cc1146f" | ||
"gitHead": "0cdc12695090479f24d4f9e6e7ef548c6a15b9cf" | ||
} |
@@ -27,2 +27,4 @@ import { isArray } from '../array'; | ||
*/ | ||
export function isRef<R extends Ref<any>>(thing?: R): thing is R; | ||
export function isRef<K extends string>(thing: any, refType: K): thing is Ref<K>; | ||
export function isRef<R extends Ref<any>>(thing?: R): thing is R { | ||
@@ -55,3 +57,3 @@ return ( | ||
*/ | ||
export function refType<K extends string>(ref: Ref<K, any>): K { | ||
export function refType<K>(ref: Ref<K, any>): K { | ||
return ref[0] as any; | ||
@@ -67,1 +69,5 @@ } | ||
} | ||
export type RefResolver<EntityMap> = <K extends keyof EntityMap>( | ||
ref?: Ref<K>, | ||
) => EntityMap[K] | undefined; |
@@ -7,4 +7,13 @@ export { default as UnreachableError } from './errors/unreachable'; | ||
export { createQueue, Queue } from './deferred-processing/queue'; | ||
export { Ref, RefFor, AnyRef, refType, refId, isRef, createRef } from './deferred-processing/ref'; | ||
export { | ||
Ref, | ||
RefFor, | ||
AnyRef, | ||
refType, | ||
refId, | ||
isRef, | ||
createRef, | ||
RefResolver, | ||
} from './deferred-processing/ref'; | ||
export { timeout } from './promise'; | ||
export { conditionallyMergeTransformed } from './object'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
81747
1195