-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sean Hamilton
committed
Aug 28, 2019
1 parent
8dc4eb2
commit a3c211e
Showing
35 changed files
with
2,531 additions
and
2,542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { CleanOptions, OObject } from './types'; | ||
export declare const DefaultOptions: CleanOptions; | ||
/** | ||
* Remove `null` and `undefined` values from the specified object | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: null, c: undefined }; | ||
* | ||
* clean(a); // => { a: 1 } | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function clean(obj: OObject, options?: CleanOptions): OObject; | ||
export default clean; | ||
import { CleanOptions, OObject } from './types'; | ||
export declare const DefaultOptions: CleanOptions; | ||
/** | ||
* Remove `null` and `undefined` values from the specified object | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: null, c: undefined }; | ||
* | ||
* clean(a); // => { a: 1 } | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function clean(obj: OObject, options?: CleanOptions): OObject; | ||
export default clean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import { OObject } from './types'; | ||
/** | ||
* Clone the specified object. | ||
* Modifying the properties of a cloned object won't affect the original. | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1 }; | ||
* | ||
* const b = clone(a); | ||
* b.a = 2; | ||
* | ||
* console.log(a.a, b.a); // => 1 2 | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function clone(obj: OObject): OObject; | ||
export default clone; | ||
import { OObject } from './types'; | ||
/** | ||
* Clone the specified object. | ||
* Modifying the properties of a cloned object won't affect the original. | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1 }; | ||
* | ||
* const b = clone(a); | ||
* b.a = 2; | ||
* | ||
* console.log(a.a, b.a); // => 1 2 | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function clone(obj: OObject): OObject; | ||
export default clone; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { OObject } from './types'; | ||
/** | ||
* Check whether all objects deeply equal each other | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* const b = { a: 1, b: { c: 2 } }; | ||
* const c = { a: 1 }; | ||
* const d = { a: 2 }; | ||
* const e = { a: 1, b: { c: 2 } }; | ||
* const f = { a: 1, b: { c: 3 } }; | ||
* | ||
* deepEqual(a, b); // => true | ||
* deepEqual(c, d); // => false | ||
* deepEqual(e, f); // => false | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function deepEqual(obj: OObject, ...compareWith: OObject[]): boolean; | ||
export default deepEqual; | ||
import { OObject } from './types'; | ||
/** | ||
* Check whether all objects deeply equal each other | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* const b = { a: 1, b: { c: 2 } }; | ||
* const c = { a: 1 }; | ||
* const d = { a: 2 }; | ||
* const e = { a: 1, b: { c: 2 } }; | ||
* const f = { a: 1, b: { c: 3 } }; | ||
* | ||
* deepEqual(a, b); // => true | ||
* deepEqual(c, d); // => false | ||
* deepEqual(e, f); // => false | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function deepEqual(obj: OObject, ...compareWith: OObject[]): boolean; | ||
export default deepEqual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { OObject } from './types'; | ||
/** | ||
* Deflate the specified object into a one deep object | ||
* (keys will be dot notation) | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* | ||
* deflate(a); // => { a: 1, 'b.c': 2 } | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function deflate(obj: OObject): OObject; | ||
export default deflate; | ||
import { OObject } from './types'; | ||
/** | ||
* Deflate the specified object into a one deep object | ||
* (keys will be dot notation) | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* | ||
* deflate(a); // => { a: 1, 'b.c': 2 } | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function deflate(obj: OObject): OObject; | ||
export default deflate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { OObject } from './types'; | ||
/** | ||
* Delete the specified path from the object | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* | ||
* del(a, 'b.c'); // => { a: 1, b: {} } | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function del(obj: OObject, path: string): OObject; | ||
export default del; | ||
import { OObject } from './types'; | ||
/** | ||
* Delete the specified path from the object | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* | ||
* del(a, 'b.c'); // => { a: 1, b: {} } | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function del(obj: OObject, path: string): OObject; | ||
export default del; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import { EachOptions, OObject, EachCallback } from './types'; | ||
export declare const DefaultOptions: EachOptions; | ||
/** | ||
* Foreach over an objects keys | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* | ||
* each(a, (key, value) => { | ||
* console.log(key, value); | ||
* // => a 1 | ||
* // => b { c: 2 } | ||
* }); | ||
* | ||
* each(a, (key, value) => { | ||
* console.log(key, value); | ||
* // => a 1 | ||
* // => b.c 2 | ||
* }, { | ||
* follow: true, | ||
* }); | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function each(obj: OObject, cb: EachCallback, options?: EachOptions): void; | ||
export default each; | ||
import { EachOptions, OObject, EachCallback } from './types'; | ||
export declare const DefaultOptions: EachOptions; | ||
/** | ||
* Foreach over an objects keys | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* | ||
* each(a, (key, value) => { | ||
* console.log(key, value); | ||
* // => a 1 | ||
* // => b { c: 2 } | ||
* }); | ||
* | ||
* each(a, (key, value) => { | ||
* console.log(key, value); | ||
* // => a 1 | ||
* // => b.c 2 | ||
* }, { | ||
* follow: true, | ||
* }); | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function each(obj: OObject, cb: EachCallback, options?: EachOptions): void; | ||
export default each; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { OObject } from './types'; | ||
/** | ||
* Check if the specified object is empty. | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: 2 }; | ||
* const b = {}; | ||
* | ||
* empty(a); // => false | ||
* empty(b); // => true | ||
* ``` | ||
* | ||
* @throws Error | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function empty(obj: OObject): boolean; | ||
export default empty; | ||
import { OObject } from './types'; | ||
/** | ||
* Check if the specified object is empty. | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: 2 }; | ||
* const b = {}; | ||
* | ||
* empty(a); // => false | ||
* empty(b); // => true | ||
* ``` | ||
* | ||
* @throws Error | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function empty(obj: OObject): boolean; | ||
export default empty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import { OObject } from './types'; | ||
/** | ||
* Check whether all the objects are equal | ||
* (only 1 layer deep, use equalDeep for a deep comparison) | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* const b = { a: 1, b: { c: 2 } }; | ||
* const c = { a: 1 }; | ||
* const d = { a: 2 }; | ||
* const e = { a: 1, b: { c: 2 } }; | ||
* const f = { a: 1, b: { c: 3 } }; | ||
* | ||
* equal(a, b); // => true | ||
* equal(c, d); // => false | ||
* equal(e, f); // => true | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function equal(obj: OObject, ...compareWith: OObject[]): boolean; | ||
export default equal; | ||
import { OObject } from './types'; | ||
/** | ||
* Check whether all the objects are equal | ||
* (only 1 layer deep, use equalDeep for a deep comparison) | ||
* | ||
* @example | ||
* ``` | ||
* const a = { a: 1, b: { c: 2 } }; | ||
* const b = { a: 1, b: { c: 2 } }; | ||
* const c = { a: 1 }; | ||
* const d = { a: 2 }; | ||
* const e = { a: 1, b: { c: 2 } }; | ||
* const f = { a: 1, b: { c: 3 } }; | ||
* | ||
* equal(a, b); // => true | ||
* equal(c, d); // => false | ||
* equal(e, f); // => true | ||
* ``` | ||
* | ||
* @throws TypeError | ||
* | ||
* @since 1.0.0 | ||
* @version 2.0.0 | ||
*/ | ||
declare function equal(obj: OObject, ...compareWith: OObject[]): boolean; | ||
export default equal; |
Oops, something went wrong.