diff --git a/docs/README.md b/docs/README.md index f4d42e1b..54694bbe 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1580,6 +1580,7 @@ Number.isNumber(2); // true * [.$dig(target)](#Object+$dig) ⇒ \* * [.$empty()](#Object+$empty) * [.$equals(obj)](#Object+$equals) ⇒ [Boolean](#Boolean) + * [.$flatten(obj)](#Object+$flatten) ⇒ [Object](#Object) * [.$forEach(fn)](#Object+$forEach) * [.$get(key)](#Object+$get) ⇒ \* * [.$invert()](#Object+$invert) ⇒ [Object](#Object) @@ -1709,6 +1710,21 @@ Performs a deep comparison between two values to determine if they are equivalen ```javascript ({ a: [2, { e: 3 }], b: [4], c: 'foo' }).$equals({ a: [2, { e: 3 }], b: [4], c: 'foo' }); // true ``` + + +### object.$flatten(obj) ⇒ [Object](#Object) +Flattens the object into a single-depth object + +**Kind**: instance method of [Object](#Object) + +| Param | Type | +| --- | --- | +| obj | [Object](#Object) | + +**Example** +```javascript +({ foo: 1, bar: { foo: 2 } }).$flatten(); // { foo: 1, "bar.foo": 2 } +``` ### object.$forEach(fn) diff --git a/package-lock.json b/package-lock.json index d2fb7e99..6f0c4b7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prototyped.js", - "version": "0.21.0", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -5997,7 +5997,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -7028,7 +7028,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -7106,7 +7106,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { diff --git a/package.json b/package.json index 1b3d40c8..32f6b78c 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "prototyped.js", - "version": "0.21.0", + "version": "1.0.0", "description": "Common typescript ready prototypes available in both es5 and es6", - "author": "Ardalan Amini [https://github.com/ardalanamini]", + "author": "Ardalan Amini [https://ardalanamini.com]", "license": "MIT", "homepage": "https://prototyped.js.org", "repository": { diff --git a/src/object/flatten/index.ts b/src/object/flatten/index.ts index edfaf727..78d8f31a 100644 --- a/src/object/flatten/index.ts +++ b/src/object/flatten/index.ts @@ -11,7 +11,6 @@ declare global { * Flattens the object into a single-depth object * @memberof Object.prototype * @function $flatten - * @param {Object} obj * @returns {Object} * @example * ({ foo: 1, bar: { foo: 2 } }).$flatten(); // { foo: 1, "bar.foo": 2 }