Comparing version 2.0.1 to 2.1.0
{ | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"tags": { | ||
@@ -4,0 +4,0 @@ "allowUnknownTags" : true |
@@ -0,2 +1,8 @@ | ||
## <sub>v2.0.1</sub> | ||
#### *Jan.2, 2016* — [Docs](https://rawgit.com/chiedolabs/objob/eab24dc9db95c4ed298de54f1d4f72fb551d63f7/docs/ob.html) | ||
* Heavily improved the docs. | ||
## <sub>v2.0.0</sub> | ||
#### *Jan.1, 2016* — [Docs](https://rawgit.com/chiedolabs/objob/b8b9b186bf186848d4ac642159e9540fb666e901/docs/ob.html) | ||
@@ -3,0 +9,0 @@ |
@@ -57,2 +57,4 @@ 'use strict'; | ||
var allKeys = ob.keys(ob.flatten(subject)); | ||
console.log('---------'); | ||
console.log(allKeys); | ||
var keysToKeep = []; | ||
@@ -305,3 +307,3 @@ | ||
/** | ||
* Return all keys for an object. | ||
* Return all keys for an object recursively, including in arrays. | ||
* | ||
@@ -318,2 +320,8 @@ * @example | ||
* | ||
* @example | ||
* let x = [{ a: 1, b: 2, c: 3}, {d: 1}] | ||
* | ||
* ob.keys(x) | ||
* // → ['a','b','c', 'd'] | ||
* | ||
* @param {object} subject The object whose keys you wish to retrieve. | ||
@@ -350,9 +358,13 @@ * @returns {string[]} The keys | ||
} | ||
} else { | ||
return (0, _uniques2.default)(keys); | ||
} else if ((0, _typeOf2.default)(subject) === 'object') { | ||
for (var k in subject) { | ||
keys.push(k); | ||
keys = keys.concat(ob.keys(k)); | ||
}; | ||
return (0, _uniques2.default)(keys); | ||
} else { | ||
keys.push(subject); | ||
return (0, _uniques2.default)(keys); | ||
} | ||
return (0, _uniques2.default)(keys); | ||
}, | ||
@@ -542,3 +554,3 @@ /** | ||
/** | ||
* Returns all values for a given object. | ||
* Returns all values for a given object recursively. | ||
* | ||
@@ -555,2 +567,13 @@ * @example | ||
* | ||
* @example | ||
* let x = { | ||
* a: 1, | ||
* b: 2, | ||
* c: 3, | ||
* d: [4] | ||
* } | ||
* | ||
* ob.values(x) | ||
* // → [1, 2, 3, 4] | ||
* | ||
* @param {object} subject The object to get the values of | ||
@@ -587,9 +610,13 @@ * @returns {any[]} | ||
} | ||
} else { | ||
return (0, _uniques2.default)(values); | ||
} else if ((0, _typeOf2.default)(subject) === 'object') { | ||
for (var k in subject) { | ||
values.push(subject[k]); | ||
values = values.concat(ob.values(subject[k])); | ||
}; | ||
return (0, _uniques2.default)(values); | ||
} else { | ||
values.push(subject); | ||
return (0, _uniques2.default)(values); | ||
} | ||
return (0, _uniques2.default)(values); | ||
} | ||
@@ -596,0 +623,0 @@ }; |
{ | ||
"name": "objob", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A tool for controlling and manipulating javascript object fields and output.", | ||
@@ -5,0 +5,0 @@ "main": "lib/objob.js", |
@@ -41,2 +41,4 @@ 'use strict'; | ||
let allKeys = ob.keys(ob.flatten(subject)); | ||
console.log('---------'); | ||
console.log(allKeys); | ||
let keysToKeep = []; | ||
@@ -201,3 +203,3 @@ | ||
/** | ||
* Return all keys for an object. | ||
* Return all keys for an object recursively, including in arrays. | ||
* | ||
@@ -214,2 +216,8 @@ * @example | ||
* | ||
* @example | ||
* let x = [{ a: 1, b: 2, c: 3}, {d: 1}] | ||
* | ||
* ob.keys(x) | ||
* // → ['a','b','c', 'd'] | ||
* | ||
* @param {object} subject The object whose keys you wish to retrieve. | ||
@@ -225,9 +233,13 @@ * @returns {string[]} The keys | ||
} | ||
} else { | ||
return uniques(keys); | ||
} else if(type(subject) === 'object') { | ||
for(let k in subject) { | ||
keys.push(k); | ||
keys = keys.concat(ob.keys(k)); | ||
}; | ||
return uniques(keys); | ||
} else { | ||
keys.push(subject); | ||
return uniques(keys); | ||
} | ||
return uniques(keys); | ||
}, | ||
@@ -372,3 +384,3 @@ /** | ||
/** | ||
* Returns all values for a given object. | ||
* Returns all values for a given object recursively. | ||
* | ||
@@ -385,2 +397,13 @@ * @example | ||
* | ||
* @example | ||
* let x = { | ||
* a: 1, | ||
* b: 2, | ||
* c: 3, | ||
* d: [4] | ||
* } | ||
* | ||
* ob.values(x) | ||
* // → [1, 2, 3, 4] | ||
* | ||
* @param {object} subject The object to get the values of | ||
@@ -396,9 +419,13 @@ * @returns {any[]} | ||
} | ||
} else { | ||
return uniques(values); | ||
} else if(type(subject) === 'object') { | ||
for(let k in subject) { | ||
values.push(subject[k]); | ||
values = values.concat(ob.values(subject[k])); | ||
}; | ||
return uniques(values); | ||
} else { | ||
values.push(subject); | ||
return uniques(values); | ||
} | ||
return uniques(values); | ||
}, | ||
@@ -405,0 +432,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1230870
69
3891
0