Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexcaza/listjs
Super tiny function that works like PHP's list() function
https://github.com/alexcaza/listjs
Last synced: 4 days ago
JSON representation
Super tiny function that works like PHP's list() function
- Host: GitHub
- URL: https://github.com/alexcaza/listjs
- Owner: alexcaza
- License: mit
- Created: 2015-12-31T04:38:03.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-31T04:57:05.000Z (almost 9 years ago)
- Last Synced: 2023-03-03T02:47:44.377Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ListJS
Super tiny function that works like PHP's list() function### Installation
---------------
#### In the browser:All you have to do is `git clone https://github.com/alexcaza/ListJS.git` into your directory and include the script file into your html file!
```html
```
#### NodeJS:
Simply require the file
```javascript
var list = require('path/to/list');
```
and you're done!### Usage
---------------
```javascript
// NodeJS
function run() {
let data = ['thing1', 'thing2']
list('var1', 'var2')(data)console.log(var1, var2)
}
run() // output => thing1 thing2
```
`list` Has one optional parameter, an object to bind to. if one isn't present, it'll default to `global` for Node or `window` for browsers. it can take as many variables as you can throw at is.````javascript
list(...arguments[, boundObject])(array)
```
---------------Please feel free to fork it and make it better! It's not perfect, by any means. It's something I hacked together for fun.
If one person finds it useful I feel like it's served it's purpose.