@@ -23,6 +23,10 @@ Functional methods like forEach, map, filter, and other Array methods for Object
23
23
24
24
[ forEach] ( https://github.com/tjmehta/object-loops#forEach )
25
25
26
+ [ keys] ( https://github.com/tjmehta/object-loops#keys )
27
+
28
+ [ keysIn] ( https://github.com/tjmehta/object-loops#keysIn )
29
+
26
30
[ mapKeys] ( https://github.com/tjmehta/object-loops#mapKeys )
27
31
28
32
[ map] ( https://github.com/tjmehta/object-loops#map )
@@ -31,6 +35,10 @@ Functional methods like forEach, map, filter, and other Array methods for Object
31
35
32
36
[ some] ( https://github.com/tjmehta/object-loops#some )
33
37
38
+ [ values] ( https://github.com/tjmehta/object-loops#values )
39
+
40
+ [ valuesIn] ( https://github.com/tjmehta/object-loops#valuesIn )
41
+
34
42
# Usage
35
43
36
44
#### You can require each method individually ` object-loops/<loop> `
@@ -238,6 +246,44 @@ keyConcat // = 'foobarbaz'
238
246
valSum // = 60
239
247
```
240
248
249
+ ## keys
250
+
251
+ Equivalent to ` Object.keys ` . Implemented specifically for chain.
252
+
253
+ ``` js
254
+ var chain = require (' object-loops/chain' )
255
+
256
+ var obj = {
257
+ foo: 10 ,
258
+ bar: 20 ,
259
+ baz: 30
260
+ }
261
+ chain (obj)
262
+ .keys ()
263
+ .toJSON ()
264
+ // ['foo', 'bar', 'baz']
265
+ ```
266
+
267
+ ## keysIn
268
+
269
+ Like to ` keys ` , but includes enumerable keys from the prototype chain.
270
+
271
+ ``` js
272
+ var keysIn = require (' object-loops/keys-in' )
273
+
274
+ function Person (name ) {
275
+ this .name = name
276
+ }
277
+ Person .prototype .getName = function () {
278
+ return this .name
279
+ }
280
+
281
+ var person = new Person (' foo' )
282
+ keysIn (obj)
283
+ // ['name', 'getName']
284
+ // for comparison, `keys` would return ['name']
285
+ ```
286
+
241
287
## mapKeys
242
288
243
289
Creates a new object with the results of calling a provided function on every key in the object.
@@ -345,6 +391,45 @@ anyGreaterThan25 // true
345
391
*/
346
392
```
347
393
394
+ ## values
395
+
396
+ Like to ` keys ` , but returns direct enumerable values.
397
+
398
+ ``` js
399
+ var values = require (' object-loops/values' )
400
+
401
+ function Person (name ) {
402
+ this .name = name
403
+ }
404
+ Person .prototype .getName = function () {
405
+ return this .name
406
+ }
407
+
408
+ var person = new Person (' foo' )
409
+ values (obj)
410
+ // ['foo']
411
+ // for comparison, `valuesIn` would return ['foo', Person.prototype.getName]
412
+ ```
413
+
414
+ ## valuesIn
415
+
416
+ Like to ` keys ` , but returns direct enumerable values including prototype chain.
417
+
418
+ ``` js
419
+ var valuesIn = require (' object-loops/values-in' )
420
+
421
+ function Person (name ) {
422
+ this .name = name
423
+ }
424
+ Person .prototype .getName = function () {
425
+ return this .name
426
+ }
427
+
428
+ var person = new Person (' foo' )
429
+ valuesIn (obj)
430
+ // ['foo', Person.prototype.getName]
431
+ ```
432
+
348
433
## License
349
434
350
435
MIT
0 commit comments