@harlem/utilities
Advanced tools
Comparing version 1.3.2 to 2.0.0-alpha.0
@@ -1,2 +0,22 @@ | ||
export { default as clone } from './clone'; | ||
export { default as overwrite } from './overwrite'; | ||
declare function clone<TValue = unknown>(value: TValue): TValue; | ||
declare function lock<T extends object>(input: T, exclusions: (keyof T)[]): T; | ||
declare function overwrite<TTarget extends object, TSource extends object>(target: TTarget, source: TSource): TTarget | TSource; | ||
declare function fromPath<TValue extends object>(value: TValue, path: string | PropertyKey[]): object | undefined; | ||
declare function toPath(nodes: PropertyKey[]): string; | ||
interface Constructable<TValue = unknown> { | ||
constructor: new (...args: unknown[]) => TValue; | ||
} | ||
declare type RuntimeType = 'boolean' | 'number' | 'string' | 'error' | 'date' | 'regexp' | 'function' | 'symbol' | 'array' | 'object' | 'map' | 'set' | 'null' | 'undefined'; | ||
declare function getType(input: unknown): RuntimeType; | ||
declare function isArray(value: unknown): value is unknown[]; | ||
declare function isObject(value: unknown): value is object; | ||
export { Constructable, RuntimeType, clone, fromPath, getType, isArray, isObject, lock, overwrite, toPath }; |
{ | ||
"name": "@harlem/utilities", | ||
"amdName": "harlemUtilities", | ||
"version": "1.3.2", | ||
"version": "2.0.0-alpha.0", | ||
"license": "MIT", | ||
@@ -9,7 +9,9 @@ "author": "Andrew Courtice <andrewcourtice@users.noreply.github.com>", | ||
"homepage": "https://harlemjs.com", | ||
"main": "dist/harlem-utilities.cjs.js", | ||
"module": "dist/harlem-utilities.bundler.esm.js", | ||
"unpkg": "dist/harlem-utilities.min.js", | ||
"types": "dist/index.d.ts", | ||
"source": "src/index.ts", | ||
"type": "module", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"exports": "./dist/index.js", | ||
"unpkg": "./dist/index.global.js", | ||
"types": "./dist/index.d.ts", | ||
"source": "./src/index.ts", | ||
"keywords": [ | ||
@@ -19,4 +21,3 @@ "vue", | ||
"harlem", | ||
"plugin", | ||
"transaction" | ||
"utilities" | ||
], | ||
@@ -32,7 +33,7 @@ "repository": { | ||
"scripts": { | ||
"dev": "microbundle watch --raw", | ||
"build": "node build.js", | ||
"dev": "tsup --watch src", | ||
"build": "tsup", | ||
"prepublish": "yarn build" | ||
}, | ||
"gitHead": "318bb50d14eff913430e69d3172de60657c34831" | ||
"gitHead": "f42a5c271a4d8d209ba33f278092a40b9a6f1475" | ||
} |
@@ -1,2 +0,11 @@ | ||
export { default as clone } from './clone'; | ||
export { default as overwrite } from './overwrite'; | ||
export { default as clone } from './object/clone'; | ||
export { default as lock } from './object/lock'; | ||
export { default as overwrite } from './object/overwrite'; | ||
export { default as fromPath } from './object/from-path'; | ||
export { default as toPath } from './object/to-path'; | ||
export { default as getType } from './type/get-type'; | ||
export { default as isArray } from './type/is-array'; | ||
export { default as isObject } from './type/is-object'; | ||
export * from './types'; |
@@ -0,1 +1,5 @@ | ||
export interface Constructable<TValue = unknown> { | ||
constructor: new (...args: unknown[]) => TValue; | ||
} | ||
export type RuntimeType = 'boolean' | ||
@@ -2,0 +6,0 @@ | 'number' |
@@ -1,4 +0,4 @@ | ||
import clone from '../src/clone'; | ||
import clone from '../src/object/clone'; | ||
function getSimpleTypes(): Record<string, any> { | ||
function getSimpleTypes(): Record<string, unknown> { | ||
return { | ||
@@ -10,7 +10,7 @@ num: 1, | ||
return a + b; | ||
} | ||
}, | ||
}; | ||
} | ||
function getComplexTypes(): Record<string, any> { | ||
function getComplexTypes(): Record<string, unknown> { | ||
const map = new Map(); | ||
@@ -25,3 +25,3 @@ const set = new Set(); | ||
obj: { | ||
a: 'test' | ||
a: 'test', | ||
}, | ||
@@ -44,7 +44,7 @@ arr: [1, 2, 3], | ||
describe('Clone', () => { | ||
test('Should deep clone an object with simple types', () => { | ||
const source = getSimpleTypes(); | ||
const copy = clone(source); | ||
for (const key in source) { | ||
@@ -54,7 +54,7 @@ expect(copy[key]).toBe(source[key]); | ||
}); | ||
test('Should deep clone an object with complex types', () => { | ||
const source = getComplexTypes(); | ||
const copy = clone(source); | ||
for (const key in source) { | ||
@@ -64,5 +64,5 @@ expect(copy[key]).not.toBe(source[key]); | ||
}); | ||
}); | ||
}); |
@@ -1,2 +0,2 @@ | ||
import overwrite from '../src/overwrite'; | ||
import overwrite from '../src/object/overwrite'; | ||
@@ -6,3 +6,3 @@ describe('Utilities', () => { | ||
describe('Overwrite', () => { | ||
test('Should overwrite an objects properties with anothers', () => { | ||
@@ -14,13 +14,13 @@ const source = { | ||
d: { | ||
a: new Date() | ||
a: new Date(), | ||
}, | ||
e: [1, 2, 3] | ||
e: [1, 2, 3], | ||
}; | ||
overwrite(source, { | ||
a: 'hello', | ||
b: 5, | ||
d: [1, 2] | ||
d: [1, 2], | ||
}); | ||
expect(typeof source.a).toBe('string'); | ||
@@ -32,5 +32,5 @@ expect(typeof source.b).toBe('number'); | ||
}); | ||
}); | ||
}); |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Yes
39326
23
597
1
1