Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/javanile/boor

🐮 Use only if you hate good manners
https://github.com/javanile/boor

boorish foreach functional-programming nodejs statements

Last synced: about 1 month ago
JSON representation

🐮 Use only if you hate good manners

Awesome Lists containing this project

README

        

# boor

**Warning!** This is not a polite library.

### (SYNC) Loop through **Array** items

```js
/**
* Loop through values only
*/
let values = ['Apple', 'Banana', 'Cagaita']

foreach(values, (value) => {
console.log('=>', value)
})

// Output:
//=> Apple
//=> Banana
//=> Cagaita
```

```js
/**
* Loop through key-value pairs
*/
let values = ['Apple', 'Banana', 'Cagaita']

foreach(values, (key, value) => {
console.log(key, '=>', value)
})

// Output:
//0 => "Apple"
//1 => "Banana"
//2 => "Cagaita"
```

### (ASYNC) Loop through **Array** items

```js
/**
* Loop through values only
*/
let values = ['Apple', 'Banana', 'Cagaita']

foreach(values, (index, next) => {
console.log('=>', value)
next()
}).then(() => {
console.log('=> --end--')
})

// Output:
//=> Apple
//=> Banana
//=> Cagaita
//=> --end--
```

```js
/**
* Loop through key-value pairs
*/
let values = ['Apple', 'Banana', 'Cagaita']

foreach(values, (key, value) => {
console.log(key, '=>', value)
})

// Output:
//0 => "Apple"
//1 => "Banana"
//2 => "Cagaita"
```