@harlem/utilities
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -141,2 +141,7 @@ // src/type/get-type.ts | ||
} | ||
// src/type/is-nil.ts | ||
function isNil(value) { | ||
return value == null; | ||
} | ||
export { | ||
@@ -147,2 +152,3 @@ clone, | ||
isArray, | ||
isNil, | ||
isObject, | ||
@@ -149,0 +155,0 @@ lock, |
@@ -38,2 +38,3 @@ var HarlemUtilities = (() => { | ||
isArray: () => isArray, | ||
isNil: () => isNil, | ||
isObject: () => isObject, | ||
@@ -184,4 +185,9 @@ lock: () => lock, | ||
} | ||
// src/type/is-nil.ts | ||
function isNil(value) { | ||
return value == null; | ||
} | ||
return src_exports; | ||
})(); | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,3 @@ import { UnwrapRef } from 'vue'; | ||
declare function fromPath<TValue extends object>(value: TValue, path: string | PropertyKey[]): object | undefined; | ||
declare function fromPath<TValue extends object>(value: TValue, path: string | PropertyKey[]): unknown; | ||
@@ -27,2 +27,4 @@ declare function toPath(nodes: PropertyKey[]): string; | ||
export { Constructable, RuntimeType, clone, fromPath, getType, isArray, isObject, lock, omit, overwrite, toPath }; | ||
declare function isNil(value: unknown): value is null | undefined; | ||
export { Constructable, RuntimeType, clone, fromPath, getType, isArray, isNil, isObject, lock, omit, overwrite, toPath }; |
@@ -142,2 +142,6 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/type/get-type.ts | ||
// src/type/is-nil.ts | ||
function isNil(value) { | ||
return value == null; | ||
} | ||
@@ -152,3 +156,5 @@ | ||
exports.clone = clone; exports.fromPath = fromPath; exports.getType = getType; exports.isArray = isArray; exports.isObject = isObject; exports.lock = lock; exports.omit = omit; exports.overwrite = overwrite; exports.toPath = toPath; | ||
exports.clone = clone; exports.fromPath = fromPath; exports.getType = getType; exports.isArray = isArray; exports.isNil = isNil; exports.isObject = isObject; exports.lock = lock; exports.omit = omit; exports.overwrite = overwrite; exports.toPath = toPath; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@harlem/utilities", | ||
"amdName": "harlemUtilities", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"license": "MIT", | ||
@@ -36,5 +36,5 @@ "author": "Andrew Courtice <andrewcourtice@users.noreply.github.com>", | ||
"scripts": { | ||
"dev": "tsup --watch src", | ||
"build": "tsup", | ||
"prepublish": "yarn build" | ||
"dev": "yarn run --top-level tsup --watch src", | ||
"build": "yarn run --top-level tsup", | ||
"prepublishOnly": "yarn build" | ||
}, | ||
@@ -47,3 +47,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "3190d001996eabcac47e293bc956cb2000088623" | ||
"gitHead": "c72c6733c53bea4c04a4c519326697c4a00cada3" | ||
} |
@@ -11,3 +11,4 @@ export { default as clone } from './object/clone'; | ||
export { default as isObject } from './type/is-object'; | ||
export { default as isNil } from './type/is-nil'; | ||
export * from './types'; |
import isArray from '../type/is-array'; | ||
export default function fromPath<TValue extends object>(value: TValue, path: string | PropertyKey[]): object | undefined { | ||
export default function fromPath<TValue extends object>(value: TValue, path: string | PropertyKey[]): unknown { | ||
const nodes = isArray(path) ? path : path.split('/'); | ||
return nodes.reduce((branch, node) => (branch as any)?.[node], value); | ||
} |
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
52139
32
851