Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "like-ar", | ||
"description": "Using objects like arrays with map, filter, forEach and others coming soon.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": "Codenautas <codenautas@googlegroups.com>", | ||
@@ -6,0 +6,0 @@ "repository": "codenautas/like-ar", |
@@ -26,2 +26,8 @@ # like-ar | ||
# Usage | ||
The function `likeAr` wraps an object. The wraped object can be used like an array | ||
with some array functions: `forEach`, `map`, `filter` y `join`. | ||
These functions receive a callback in the same way that the array version does. | ||
```sh | ||
@@ -40,2 +46,29 @@ var likeAr = require('like-ar'); | ||
# API | ||
The callback functions receive these parameters: `value`, `key` and the original object. | ||
The functions that in the Array case returns Arrays returns a chainable object. | ||
function | returned value | ||
--------------------|-------------------- | ||
`forEach(cb, this)` | `undefined` | ||
`map(cb, this)` | chainable object with the same keys and the value mapeds | ||
`filter(db, this)` | chainable object with the same keys and values for only that key/value that returns true in the callback function | ||
`join(separator)` | string with the join of the values | ||
`array()` | array of values | ||
`keys()` | array of keys | ||
# Usage | ||
```sh | ||
var likeAr = require('like-ar'); | ||
var object={ | ||
lastName:'Perez', | ||
firstName:'Diego' | ||
} | ||
likeAr(object).forEach(function(value, attrName, object){ | ||
console.log(attrName,':',value); | ||
}); | ||
``` | ||
## License | ||
@@ -42,0 +75,0 @@ |
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
9349
76