Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taskrjs/fly-util
Fly Utility Toolbox
https://github.com/taskrjs/fly-util
Last synced: about 2 months ago
JSON representation
Fly Utility Toolbox
- Host: GitHub
- URL: https://github.com/taskrjs/fly-util
- Owner: taskrjs
- License: mit
- Created: 2015-07-08T11:55:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-25T17:44:06.000Z (almost 9 years ago)
- Last Synced: 2024-02-27T03:45:10.440Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 81.1 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
> Fly Utilities
[![][fly-badge]][fly]
[![npm package][npm-ver-link]][fly-util]
[![][dl-badge]][npm-pkg-link]
[![][travis-logo]][travis]
![][mit-badge]## About
> [_Fly_][fly] is a modern [build system](https://en.wikipedia.org/wiki/Build_automation) for [Node](https://nodejs.org/) based in [_co_-routines](https://medium.com/@tjholowaychuk/callbacks-vs-coroutines-174f1fe66127), [generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) and [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
## Install
```
npm install fly-util
```## Usage
```js
import util from "fly-util"
```## API
## `log`
```js
function log (...args)
```
Wrapper for `Console.log`.## `error`
```js
function error (...args)
```
Wrapper for `Console.error`.## `alert`
```js
function alert (...args)
```
Wrapper for `Console.log` in a distinctive color. Set `process.env.VERBOSE` to show output.## `trace`
```js
function trace (e)
```
+ `e {Object}` error objectWrapper for [`prettyjson`](https://github.com/rafeca/prettyjson).
## `defer`
```js
function defer (asyncFunc)
```
+ `asyncFunc {Function}` async function of the form (value, options, cb)
+ `return` `{Function}` new function that returns a promisePromisify a function with a callback.
## `flatten`
```js
function flatten (array)
```
+ `array {Array}`
+ `return` `[[a],[b],[c]] → [a,b,c]`Flatten a nested array recursively.
## `filter`
```js
function filter (pkg, load, blacklist = [], bind = true)
```
+ `pkg {Package}` project's package.json
+ `load {Function}` load handler
+ `blacklist {Array}` blacklisted plugins
+ `return {Array}` list of fly dependencies that can be loadedFind `fly-*` plugins listed in a package dependencies.
## `expand`
```js
function expand (pattern, options)
```
+ `pattern {String}` Pattern to match
+ `handler {Object}` [options](https://github.com/isaacs/node-glob#options) to glob
+ `return {Promise}`Promisified [glob](https://github.com/isaacs/node-glob) wrapper.
## `find`
```js
function* find (path, names)
```
+ `path {String}` file or path to the Flyfile
+ `bind {Function}` Optional. use to bind require or process path
+ `return {String}` path to the FlyfileFind a valid Flyfile from a given path. If `path` is a directory find the first Flyfile with a [supported](https://github.com/tkellen/js-interpret) extension.
## `bind`
```js
function bind (path, names)
```+ `path {String}` file or path to the Flyfile
+ `return {String}` path to the FlyfileBind to node's require based in the file extension of your Flyfile.
> Support ES6/7 by default, but Flyfiles can be written in any language supported in [interpret](https://github.com/tkellen/js-interpret).
## Dependencies
+ [`mz/fs`](https://github.com/normalize/mz) promise wrapped basic IO handling
+ [`clor`](https://github.com/bucaran/clor) terminal colors
+ [`glob`](https://github.com/isaacs/node-glob) expanding path/file glob patterns
+ [`prettyjson`](https://github.com/rafeca/prettyjson) pretty formatting for JSON objects
+ [`interpret`](https://github.com/tkellen/js-interpret) resolve modules for in-the-fly compilation.
+ [`update-notifier`](https://github.com/yeoman/update-notifier) CLI update notifications# License
[MIT](http://opensource.org/licenses/MIT) © [Jorge Bucaran][Author] et [al][contributors]
:heart:[author]: http://about.bucaran.me
[contributors]: https://github.com/bucaran/fly-util/graphs/contributors
[fly]: https://www.github.com/bucaran/fly
[fly-util]: https://www.github.com/bucaran/fly-util
[fly-badge]: https://img.shields.io/badge/fly-JS-05B3E1.svg?style=flat-square
[mit-badge]: https://img.shields.io/badge/license-MIT-444444.svg?style=flat-square
[npm-pkg-link]: https://www.npmjs.org/package/fly-util
[npm-ver-link]: https://img.shields.io/npm/v/fly-util.svg?style=flat-square
[dl-badge]: http://img.shields.io/npm/dm/fly-util.svg?style=flat-square
[travis-logo]: http://img.shields.io/travis/bucaran/fly-util.svg?style=flat-square
[travis]: https://travis-ci.org/bucaran/fly-util