Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/one-aalam/flyt
Super-light javascript library to flatten arrays
https://github.com/one-aalam/flyt
array-flatten es6 javascript mini-library
Last synced: 16 days ago
JSON representation
Super-light javascript library to flatten arrays
- Host: GitHub
- URL: https://github.com/one-aalam/flyt
- Owner: one-aalam
- Created: 2017-02-21T08:42:25.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-21T21:13:44.000Z (almost 8 years ago)
- Last Synced: 2024-10-19T16:54:13.137Z (2 months ago)
- Topics: array-flatten, es6, javascript, mini-library
- Language: JavaScript
- Size: 615 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# flyt
Super-light javascript library to flatten arrays### Outline
This library exposes functionality to transalte an array of
arbitarily nested arrays of integers into a flat array of integers. e.g.
`[[1, 2, [3]], 4] -> [1, 2, 3, 4]`
It is trivial code but organised to support future extensions and is just
one step away from `npm publish`.### Features
1. Bundles library code into all library targets ie CommonJS, AMD, ES2015 exports, UMD.
### Setup
For build generation, Node is required. Ensure Node's available and run `npm i` in project's root directory. Find build generation step in [Usage](#Usage) section(next).### Usage
- New builds could be created anytime running `npm build` or `npm build:min`
- To update examples code, run `npm update:browser-build` or `npm update:node-build`. Distributable file is updated in `/dist` before
preparing examples.
- Open [index.html](/examples/browser/index.html)(Browser) or fire `node examples/node/index.js`(Node) to check code's
functionality for respective environment.
- Method will be available as _flyt.**flatten([])**_
- Browser: `flyt.flatten([])`
- Node: `var flyt = require('./flyt'); flyt.flatten([]);`
- Run tests calling `npm run test` from CLI and you shall see something like
![flyt_test_pass](/res/flyt_test_pass.gif)### Drawback
Built for demonstration purposes.