Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/each
Object / array / array-ish / string iteration utility
https://github.com/component/each
Last synced: 12 days ago
JSON representation
Object / array / array-ish / string iteration utility
- Host: GitHub
- URL: https://github.com/component/each
- Owner: component
- Created: 2012-09-21T16:09:12.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-15T16:37:53.000Z (almost 9 years ago)
- Last Synced: 2024-12-10T04:56:28.218Z (18 days ago)
- Language: JavaScript
- Size: 283 KB
- Stars: 14
- Watchers: 4
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# each
Array / object / string iteration utility.
## Installation
$ component install component/each
## API
### each(array, fn[, ctx])
Iterate an array:
```js
each([1,2,3], function(num, i){
})
```Optionally pass a context object:
```js
each([1,2,3], function(num, i){}, this)
```### each(object, fn[, ctx])
Iterate an object's key / value pairs:
```js
each(conf, function(key, val){
})
```Iterate an array-ish object (has numeric `.length`):
```js
each(collection, function(val, i){
})
```### each(string, fn[, ctx])
Iterate a string's characters:
```js
each('hello', function(c, i){
})
```# License
MIT