@harlem/utilities
Advanced tools
Comparing version 1.1.1 to 1.1.3
{ | ||
"name": "@harlem/utilities", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"license": "MIT", | ||
@@ -39,3 +39,3 @@ "author": "Andrew Courtice <andrewcourtice@users.noreply.github.com>", | ||
}, | ||
"gitHead": "9d86a91860120c1815b0c0244d82b7d76e4ddd16" | ||
"gitHead": "4345a656ed321f5210032f07627c9e146118bbd2" | ||
} |
@@ -39,22 +39,26 @@ import clone from '../src/clone'; | ||
describe('Clone', () => { | ||
test('Should deep clone an object with simple types', () => { | ||
const source = getSimpleTypes(); | ||
const copy = clone(source); | ||
for (const key in source) { | ||
expect(copy[key]).toBe(source[key]); | ||
} | ||
}); | ||
describe('Utilities', () => { | ||
test('Should deep clone an object with complex types', () => { | ||
const source = getComplexTypes(); | ||
const copy = clone(source); | ||
describe('Clone', () => { | ||
for (const key in source) { | ||
expect(copy[key]).not.toBe(source[key]); | ||
} | ||
test('Should deep clone an object with simple types', () => { | ||
const source = getSimpleTypes(); | ||
const copy = clone(source); | ||
for (const key in source) { | ||
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) { | ||
expect(copy[key]).not.toBe(source[key]); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |
import overwrite from '../src/overwrite'; | ||
describe('Overwrite', () => { | ||
describe('Utilities', () => { | ||
test('Should overwrite an objects properties with anothers', () => { | ||
const source = { | ||
a: 1, | ||
b: null, | ||
c: 'Hello', | ||
d: { | ||
a: new Date() | ||
}, | ||
e: [1, 2, 3] | ||
}; | ||
overwrite(source, { | ||
a: 'hello', | ||
b: 5, | ||
d: [1, 2] | ||
describe('Overwrite', () => { | ||
test('Should overwrite an objects properties with anothers', () => { | ||
const source = { | ||
a: 1, | ||
b: null, | ||
c: 'Hello', | ||
d: { | ||
a: new Date() | ||
}, | ||
e: [1, 2, 3] | ||
}; | ||
overwrite(source, { | ||
a: 'hello', | ||
b: 5, | ||
d: [1, 2] | ||
}); | ||
expect(typeof source.a).toBe('string'); | ||
expect(typeof source.b).toBe('number'); | ||
expect(source.c).toBeUndefined(); | ||
expect(Array.isArray(source.d)).toBe(true); | ||
expect(source.e).toBeUndefined(); | ||
}); | ||
expect(typeof source.a).toBe('string'); | ||
expect(typeof source.b).toBe('number'); | ||
expect(source.c).toBeUndefined(); | ||
expect(Array.isArray(source.d)).toBe(true); | ||
expect(source.e).toBeUndefined(); | ||
}); | ||
}); |
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
29355
175