blob: 16a81bda8d6e4340efec506dc4a775861d7d2813 [file] [log] [blame]
{
"name": "utile",
"description": "A drop-in replacement for `util` with some additional advantageous functions",
"version": "0.2.1",
"author": {
"name": "Nodejitsu Inc.",
"email": "info@nodejitsu.com"
},
"maintainers": [
{
"name": "indexzero",
"email": "charlie@nodejitsu.com"
}
],
"repository": {
"type": "git",
"url": "http://github.com/flatiron/utile.git"
},
"dependencies": {
"async": "~0.2.9",
"deep-equal": "*",
"i": "0.3.x",
"mkdirp": "0.x.x",
"ncp": "0.4.x",
"rimraf": "2.x.x"
},
"devDependencies": {
"vows": "0.7.x"
},
"scripts": {
"test": "vows --spec"
},
"main": "./lib/index",
"engines": {
"node": ">= 0.6.4"
},
"readme": "# utile [![Build Status](https://secure.travis-ci.org/flatiron/utile.png)](http://travis-ci.org/flatiron/utile)\n\nA drop-in replacement for `util` with some additional advantageous functions\n\n## Motivation\nJavascript is definitely a \"batteries not included language\" when compared to languages like Ruby or Python. Node.js has a simple utility library which exposes some basic (but important) functionality:\n\n```\n$ node\n> var util = require('util');\n> util.\n(...)\n\nutil.debug util.error util.exec util.inherits util.inspect\nutil.log util.p util.print util.pump util.puts\n```\n\nWhen one considers their own utility library, why ever bother requiring `util` again? That is the approach taken by this module. To compare:\n\n```\n$ node\n> var utile = require('./lib')\n> utile.\n(...)\n\nutile.async utile.capitalize utile.clone utile.cpr utile.createPath utile.debug\nutile.each utile.error utile.exec utile.file utile.filter utile.find\nutile.inherits utile.log utile.mixin utile.mkdirp utile.p utile.path\nutile.print utile.pump utile.puts utile.randomString utile.requireDir uile.requireDirLazy\nutile.rimraf\n```\n\nAs you can see all of the original methods from `util` are there, but there are several new methods specific to `utile`. A note about implementation: _no node.js native modules are modified by utile, it simply copies those methods._\n\n## Methods\nThe `utile` modules exposes some simple utility methods:\n\n* `.each(obj, iterator)`: Iterate over the keys of an object.\n* `.mixin(target [source0, source1, ...])`: Copies enumerable properties from `source0 ... sourceN` onto `target` and returns the resulting object.\n* `.clone(obj)`: Shallow clones the specified object.\n* `.capitalize(str)`: Capitalizes the specified `str`.\n* `.randomString(length)`: randomString returns a pseudo-random ASCII string (subset) the return value is a string of length ⌈bits/6⌉ of characters from the base64 alphabet.\n* `.filter(obj, test)`: return an object with the properties that `test` returns true on.\n* `.args(arguments)`: Converts function arguments into actual array with special `callback`, `cb`, `array`, and `last` properties. Also supports *optional* argument contracts. See [the example](https://github.com/flatiron/utile/blob/master/examples/utile-args.js) for more details.\n* `.requireDir(directory)`: Requires all files and directories from `directory`, returning an object with keys being filenames (without trailing `.js`) and respective values being return values of `require(filename)`.\n* `.requireDirLazy(directory)`: Lazily requires all files and directories from `directory`, returning an object with keys being filenames (without trailing `.js`) and respective values (getters) being return values of `require(filename)`.\n* `.format([string] text, [array] formats, [array] replacements)`: Replace `formats` in `text` with `replacements`. This will fall back to the original `util.format` command if it is called improperly.\n\n## Packaged Dependencies\nIn addition to the methods that are built-in, utile includes a number of commonly used dependencies to reduce the number of includes in your package.json. These modules _are not eagerly loaded to be respectful of startup time,_ but instead are lazy-loaded getters on the `utile` object\n\n* `.async`: [Async utilities for node and the browser][0]\n* `.inflect`: [Customizable inflections for node.js][6]\n* `.mkdirp`: [Recursively mkdir, like mkdir -p, but in node.js][1]\n* `.rimraf`: [A rm -rf util for nodejs][2]\n* `.cpr`: [Asynchronous recursive file copying with Node.js][3]\n\n## Installation\n\n### Installing npm (node package manager)\n```\n curl http://npmjs.org/install.sh | sh\n```\n\n### Installing utile\n```\n [sudo] npm install utile\n```\n\n## Tests\nAll tests are written with [vows][4] and should be run with [npm][5]:\n\n``` bash\n $ npm test\n```\n\n#### Author: [Nodejitsu Inc.](http://www.nodejitsu.com)\n#### Contributors: [Charlie Robbins](http://github.com/indexzero), [Dominic Tarr](http://github.com/dominictarr)\n#### License: MIT\n\n[0]: https://github.com/caolan/async\n[1]: https://github.com/substack/node-mkdirp\n[2]: https://github.com/isaacs/rimraf\n[3]: https://github.com/avianflu/ncp\n[4]: https://vowsjs.org\n[5]: https://npmjs.org\n[6]: https://github.com/pksunkara/inflect\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/flatiron/utile/issues"
},
"_id": "utile@0.2.1",
"_from": "utile@0.2.x"
}