1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-12 02:42:48 +00:00

updated package.json

This commit is contained in:
2016-01-04 12:25:28 -05:00
parent 3443c97de4
commit 80ca24a715
1168 changed files with 73752 additions and 26424 deletions

3
node_modules/forever/.npmignore generated vendored
View File

@@ -1,7 +1,8 @@
.DS_Store
test/*.log
node_modules/
node_modules/*
npm-debug.log
.*.sw[op]
test/fixtures/*.log
.idea
.idea

7
node_modules/forever/.travis.yml generated vendored
View File

@@ -1,12 +1,17 @@
sudo: false
language: node_js
node_js:
- 0.8
- 0.10
- "0.10"
- 0.12
before_install:
- curl --location http://git.io/1OcIZA | bash -s
branches:
only:
- master
matrix:
allow_failures:
- node_js: 0.8
notifications:
email:
- travis@nodejitsu.com

1101
node_modules/forever/CHANGELOG.md generated vendored

File diff suppressed because it is too large Load Diff

112
node_modules/forever/README.md generated vendored
View File

@@ -1,4 +1,9 @@
# forever [![Build Status](https://api.travis-ci.org/foreverjs/forever.svg)](https://travis-ci.org/foreverjs/forever) [![Inline docs](http://inch-ci.org/github/foreverjs/forever.svg?branch=master)](http://inch-ci.org/github/foreverjs/forever)
# forever
[![Version npm](https://img.shields.io/npm/v/forever.svg?style=flat-square)](https://www.npmjs.com/package/forever)[![npm Downloads](https://img.shields.io/npm/dm/forever.svg?style=flat-square)](https://www.npmjs.com/package/forever)[![Build Status](https://img.shields.io/travis/foreverjs/forever/master.svg?style=flat-square)](https://travis-ci.org/foreverjs/forever)[![Dependencies](https://img.shields.io/david/foreverjs/forever.svg?style=flat-square)](https://david-dm.org/foreverjs/forever)[![Inline docs](http://inch-ci.org/github/foreverjs/forever.svg?branch=master)](http://inch-ci.org/github/foreverjs/forever)
[![NPM](https://nodei.co/npm/forever.png?downloads=true&downloadRank=true)](https://nodei.co/npm/forever/)
A simple CLI tool for ensuring that a given script runs continuously (i.e. forever).
@@ -16,11 +21,17 @@ A simple CLI tool for ensuring that a given script runs continuously (i.e. forev
```
## Usage
There are two distinct ways to use forever: through the command line interface, or by requiring the forever module in your own code. **Note:** If you are using forever _programatically_ you should install [forever-monitor][0].
There are two ways to use forever: through the command line or by using forever in your code. **Note:** If you are using forever _programatically_ you should install [forever-monitor][0].
### Using forever from the command line
You can use forever to run any kind of script continuously (whether it is written in node.js or not). The usage options are simple:
### Command Line Usage
You can use forever to run scripts continuously (whether it is written in node.js or not).
**Example**
```
forever start app.js
```
**Options**
```
$ forever --help
usage: forever [action] [options] SCRIPT [script-options]
@@ -92,18 +103,69 @@ There are [several examples][1] designed to test the fault tolerance of forever.
$ forever -m 5 examples/error-on-timer.js
```
### Changing where forever writes files
### JSON Configuration Files
By default `forever` places all of the files it needs into `/$HOME/.forever`. If you would like to change that location just set the `FOREVER_ROOT` environment variable when you are running forever:
In addition to passing forever the path to a script (along with accompanying options, described above), you may also pass forever the path to a JSON file containing these options. For example, consider an application with the following file structure:
```
FOREVER_ROOT=/etc/forever forever start index.js
.
├── forever
│ └── development.json
└── index.js
// forever/development.json
{
// Comments are supported
"uid": "app",
"append": true,
"watch": true,
"script": "index.js",
"sourceDir": "/home/myuser/app"
}
```
Make sure that the user running the process has the appropriate privileges to read & write to this directory.
This application could be started with forever, as shown below:
## Using forever module from node.js
In addition to using a Forever object, the forever module also exposes some useful methods. Each method returns an instance of an EventEmitter which emits when complete. See the [forever cli commands][2] for sample usage.
``` bash
$ forever start ./forever/development.json
```
Absolute paths to such configuration files are also supported:
``` bash
$ forever start /home/myuser/app/forever/development.json
```
**Note:** Forever parses JSON configuration files using [shush](https://github.com/krakenjs/shush), allowing the use of in-line comments within such files.
#### Multi-App Configuration Files
JSON configuration files can also be used to define the startup options for *multiple* applications, as shown below.
```
[
{
// App1
"uid": "app1",
"append": true,
"watch": true,
"script": "index.js",
"sourceDir": "/home/myuser/app1"
},
{
// App2
"uid": "app2",
"append": true,
"watch": true,
"script": "index.js",
"sourceDir": "/home/myuser/app2",
"args": ["--port", "8081"]
}
]
```
### Using In Your Code
The forever module exposes some useful methods to use in your code. Each method returns an instance of an EventEmitter which emits when complete. See the [forever cli commands][2] for sample usage.
**Remark:** As of `forever@0.6.0` processes will not automatically be available in `forever.list()`. In order to get your processes into `forever.list()` or `forever list` you must instantiate the `forever` socket server:
@@ -113,7 +175,7 @@ In addition to using a Forever object, the forever module also exposes some usef
This method takes multiple `forever.Monitor` instances which are defined in the `forever-monitor` dependency.
### forever.load (config)
#### forever.load (config)
_Synchronously_ sets the specified configuration (config) for the forever module. There are two important options:
Option | Description   | Default
@@ -126,40 +188,50 @@ columns | Array of columns to display when `format` is true | `forever.config.
debug | Boolean value indicating to run in debug mode | false
stream | Boolean value indicating if logs will be streamed | false
### forever.start (file, options)
#### forever.start (file, options)
Starts a script with forever. The `options` object is what is expected by the `Monitor` of `forever-monitor`.
### forever.startDaemon (file, options)
#### forever.startDaemon (file, options)
Starts a script with forever as a daemon. WARNING: Will daemonize the current process. The `options` object is what is expected by the `Monitor` of `forever-monitor`.
### forever.stop (index)
#### forever.stop (index)
Stops the forever daemon script at the specified index. These indices are the same as those returned by forever.list(). This method returns an EventEmitter that raises the 'stop' event when complete.
### forever.stopAll (format)
#### forever.stopAll (format)
Stops all forever scripts currently running. This method returns an EventEmitter that raises the 'stopAll' event when complete.
The `format` parameter is a boolean value indicating whether the returned values should be formatted according to the configured columns which can set with `forever columns` or programmatically `forever.config.set('columns')`.
### forever.list (format, callback)
#### forever.list (format, callback)
Returns a list of metadata objects about each process that is being run using forever. This method will return the list of metadata as such. Only processes which have invoked `forever.startServer()` will be available from `forever.list()`
The `format` parameter is a boolean value indicating whether the returned values should be formatted according to the configured columns which can set with `forever columns` or programmatically `forever.config.set('columns')`.
### forever.tail (target, options, callback)
#### forever.tail (target, options, callback)
Responds with the logs from the target script(s) from `tail`. There are two options:
* `length` (numeric): is is used as the `-n` parameter to `tail`.
* `stream` (boolean): is is used as the `-f` parameter to `tail`.
### forever.cleanUp ()
#### forever.cleanUp ()
Cleans up any extraneous forever *.pid files that are on the target system. This method returns an EventEmitter that raises the 'cleanUp' event when complete.
### forever.cleanLogsSync (processes)
#### forever.cleanLogsSync (processes)
Removes all log files from the root forever directory that do not belong to current running forever processes. Processes are the value returned from `Monitor.data` in `forever-monitor`.
### forever.startServer (monitor0, monitor1, ..., monitorN)
#### forever.startServer (monitor0, monitor1, ..., monitorN)
Starts the `forever` HTTP server for communication with the forever CLI. **NOTE:** This will change your `process.title`. This method takes multiple `forever.Monitor` instances which are defined in the `forever-monitor` dependency.
### Logging and output file locations
By default `forever` places all of the files it needs into `/$HOME/.forever`. If you would like to change that location just set the `FOREVER_ROOT` environment variable when you are running forever:
```
FOREVER_ROOT=/etc/forever forever start index.js
```
Make sure that the user running the process has the appropriate privileges to read & write to this directory.
## Run Tests
``` bash

16
node_modules/forever/lib/forever.js generated vendored
View File

@@ -758,14 +758,16 @@ forever.findByUid = function (script, processes) {
// Finds the process with the specified pid.
//
forever.findByPid = function (pid, processes) {
var procs = !processes
? null
: processes.filter(function (p) {
return p.pid == pid;
});
pid = typeof pid === 'string'
? parseInt(pid, 10)
: pid;
var procs = processes && processes.filter(function (p) {
return p.pid === pid;
});
if (procs && procs.length === 0) { procs = null; }
return procs;
return procs || null;
};
//
@@ -972,7 +974,7 @@ forever.logEvents = function (monitor) {
});
monitor.on('exit:code', function (code, signal) {
forever.out.error(!isNaN(code)
forever.out.error((code !== null && code !== undefined)
? 'Forever detected script exited with code: ' + code
: 'Forever detected script was killed by signal: ' + signal);
});

View File

@@ -11,7 +11,12 @@ var fs = require('fs'),
util = require('util'),
colors = require('colors'),
cliff = require('cliff'),
isAbsolute = require('path-is-absolute'),
flatiron = require('flatiron'),
shush = require('shush'),
prettyjson = require('prettyjson'),
clone = require('clone'),
objectAssign = require('object-assign'),
forever = require('../forever');
var cli = exports;
@@ -196,7 +201,46 @@ function checkColumn(name) {
// `forever.startDaemon`
//
var getOptions = cli.getOptions = function (file) {
var options = {};
var options = {},
absFile = isAbsolute(file) ? file : path.resolve(process.cwd(), file),
configKeys = [
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'append',
'silent', 'outFile', 'max', 'command', 'path', 'spinSleepTime',
'sourceDir', 'workingDir', 'uid', 'watchDirectory', 'watchIgnore',
'killTree', 'killSignal', 'id'
],
specialKeys = ['script', 'args'],
configs;
//
// Load JSON configuration values
//
if (path.extname(file) === '.json') {
configs = shush(absFile);
configs = !Array.isArray(configs) ? [configs] : configs;
configs = configs.map(function (conf) {
var mut = Object.keys(conf)
.reduce(function (acc, key) {
if (~configKeys.indexOf(key) || ~specialKeys.indexOf(key)) {
acc[key] = conf[key];
}
return acc;
}, {});
if (!mut.script) {
forever.log.error('"script" option required in JSON configuration files');
console.log(prettyjson.render(mut));
process.exit(1);
}
return mut;
});
} else {
options.script = file;
}
//
// First isolate options which should be passed to file
//
@@ -209,12 +253,7 @@ var getOptions = cli.getOptions = function (file) {
app.config.stores.argv.store = {};
app.config.use('argv', argvOptions);
[
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'append',
'silent', 'outFile', 'max', 'command', 'path', 'spinSleepTime',
'sourceDir', 'workingDir', 'uid', 'watchDirectory', 'watchIgnore',
'killTree', 'killSignal', 'id'
].forEach(function (key) {
configKeys.forEach(function (key) {
options[key] = app.config.get(key);
});
@@ -240,7 +279,13 @@ var getOptions = cli.getOptions = function (file) {
options.workingDir = options.workingDir || options.sourceDir;
options.spawnWith = { cwd: options.workingDir };
return options;
if (configs && configs.length) {
return configs.map(function (conf) {
return objectAssign(clone(options), conf);
});
}
return [options];
};
//
@@ -264,10 +309,13 @@ app.cmd(/start (.+)/, cli.startDaemon = function () {
var file = app.argv._[1],
options = getOptions(file);
forever.log.info('Forever processing file: ' + file.grey);
tryStart(file, options, function () {
forever.startDaemon(file, options);
options.forEach(function (o) {
forever.log.info('Forever processing file: ' + o.script.grey);
tryStart(o.script, o, function () {
forever.startDaemon(o.script, o);
});
});
});
//
@@ -559,10 +607,12 @@ cli.run = function () {
var file = app.argv._[0],
options = getOptions(file);
tryStart(file, options, function () {
var monitor = forever.start(file, options);
monitor.on('start', function () {
forever.startServer(monitor);
options.forEach(function (o) {
tryStart(o.script, o, function () {
var monitor = forever.start(o.script, o);
monitor.on('start', function () {
forever.startServer(monitor);
});
});
});
};

View File

@@ -16,7 +16,7 @@
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/Marak/colors.js.git"
"url": "http://github.com/Marak/colors.js.git"
},
"license": "MIT",
"scripts": {
@@ -26,10 +26,26 @@
"node": ">=0.1.90"
},
"main": "./lib/index",
"readme": "# colors.js\n\n## get color and style in your node.js console\n\n<img src=\"https://github.com/Marak/colors.js/raw/master/screenshots/colors.png\"/>\n\n## Installation\n\n npm install colors\n\n## colors and styles!\n\n### text colors\n\n - black\n - red\n - green\n - yellow\n - blue\n - magenta\n - cyan\n - white\n - gray\n - grey\n\n### background colors\n\n\n\n - bgBlack\n - bgRed\n - bgGreen\n - bgYellow\n - bgBlue\n - bgMagenta\n - bgCyan\n - bgWhite\n\n### styles\n\n - reset\n - bold\n - dim\n - italic\n - underline\n - inverse\n - hidden\n - strikethrough\n\n### extras\n\n - rainbow\n - zebra\n - america\n - trap\n - random\n\n\n## Usage\n\nBy popular demand, `colors` now ships with two types of usages!\n\nThe super nifty way\n\n```js\nvar colors = require('colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red) // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow\nconsole.log('Run the trap'.trap); // Drops the bass\n\n```\n\nor a slightly less nifty way which doesn't extend `String.prototype`\n\n```js\nvar colors = require('colors/safe');\n\nconsole.log(colors.green('hello')); // outputs green text\nconsole.log(colors.red.underline('i like cake and pies')) // outputs red underlined text\nconsole.log(colors.inverse('inverse the color')); // inverses the color\nconsole.log(colors.rainbow('OMG Rainbows!')); // rainbow\nconsole.log(colors.trap('Run the trap')); // Drops the bass\n\n```\n\nI prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way. \n\nIf you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.\n\n## Disabling Colors\n\nTo disable colors you can pass the following arguments in the command line to your application:\n\n```bash\nnode myapp.js --no-color\n```\n\n## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)\n\n```js\nvar name = 'Marak';\nconsole.log(colors.green('Hello %s'), name);\n// outputs -> 'Hello Marak'\n```\n\n## Custom themes\n\n### Using standard API\n\n```js\n\nvar colors = require('colors');\n\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n### Using string safe API\n\n```js\nvar colors = require('colors/safe');\n\n// set single property\nvar error = colors.red;\nerror('this is red');\n\n// set theme\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(colors.error(\"this is an error\"));\n\n// outputs yellow text\nconsole.log(colors.warn(\"this is a warning\"));\n```\n\n*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*",
"readmeFilename": "ReadMe.md",
"gitHead": "e9e6557cc0fa26dba1a20b0d45e92de982f4047c",
"_id": "colors@1.0.3",
"_shasum": "0433f44d809680fdeb60ed260f1b0c262e82a40b",
"_resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
"_from": "colors@>=1.0.3 <1.1.0"
"_from": "colors@~1.0.3",
"_npmVersion": "2.0.2",
"_nodeVersion": "0.11.13",
"_npmUser": {
"name": "marak",
"email": "marak.squires@gmail.com"
},
"maintainers": [
{
"name": "marak",
"email": "marak.squires@gmail.com"
}
],
"dist": {
"shasum": "0433f44d809680fdeb60ed260f1b0c262e82a40b",
"tarball": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz"
}

View File

@@ -33,10 +33,27 @@
"engines": {
"node": "> 0.1.90"
},
"readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
"readmeFilename": "README.md",
"_id": "eyes@0.1.8",
"dist": {
"shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"tarball": "http://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
},
"_npmVersion": "1.1.53",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "cloudhead",
"email": "self@cloudhead.net"
},
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"_from": "eyes@>=0.1.8 <0.2.0"
"_from": "eyes@~0.1.8",
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
}

File diff suppressed because one or more lines are too long

View File

@@ -112,7 +112,7 @@
"homepage": "https://github.com/pvorb/node-clone",
"_id": "clone@1.0.2",
"_shasum": "260b7a99ebb1edfe247538175f783243cb19d149",
"_from": "clone@>=1.0.2 <2.0.0",
"_from": "clone@^1.0.2",
"_npmVersion": "1.4.14",
"_npmUser": {
"name": "pvorb",

View File

@@ -16,16 +16,30 @@
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/Marak/colors.js.git"
"url": "http://github.com/Marak/colors.js.git"
},
"engines": {
"node": ">=0.1.90"
},
"main": "colors",
"readme": "# colors.js - get color and style in your node.js console ( and browser ) like what\n\n<img src=\"http://i.imgur.com/goJdO.png\" border = \"0\"/>\n\n\n## Installation\n\n npm install colors\n\n## colors and styles!\n\n- bold\n- italic\n- underline\n- inverse\n- yellow\n- cyan\n- white\n- magenta\n- green\n- red\n- grey\n- blue\n- rainbow\n- zebra\n- random\n\n## Usage\n\n``` js\nvar colors = require('./colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red) // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)\n```\n\n# Creating Custom themes\n\n```js\n\nvar colors = require('colors');\n\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n\n### Contributors \n\nMarak (Marak Squires)\nAlexis Sellier (cloudhead)\nmmalecki (Maciej Małecki)\nnicoreed (Nico Reed)\nmorganrallen (Morgan Allen)\nJustinCampbell (Justin Campbell)\nded (Dustin Diaz)\n\n\n#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded)\n",
"readmeFilename": "ReadMe.md",
"_id": "colors@0.6.2",
"dist": {
"shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
"tarball": "http://registry.npmjs.org/colors/-/colors-0.6.2.tgz"
},
"_from": "colors@~0.6.2",
"_npmVersion": "1.2.30",
"_npmUser": {
"name": "marak",
"email": "marak.squires@gmail.com"
},
"maintainers": [
{
"name": "marak",
"email": "marak.squires@gmail.com"
}
],
"directories": {},
"_shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
"_resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz",
"_from": "colors@>=0.6.2 <0.7.0"
"_resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz"
}

View File

@@ -33,10 +33,28 @@
"engines": {
"node": "> 0.1.90"
},
"readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
"readmeFilename": "README.md",
"_id": "eyes@0.1.8",
"dist": {
"shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"tarball": "http://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
},
"_npmVersion": "1.1.53",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "cloudhead",
"email": "self@cloudhead.net"
},
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"_from": "eyes@0.1.x",
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"_from": "eyes@>=0.1.0 <0.2.0"
"readme": "ERROR: No README data found!"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@
"homepage": "https://github.com/douglascrockford/JSON-js",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/dscape/cycle.git"
"url": "http://github.com/dscape/cycle.git"
},
"bugs": {
"url": "http://github.com/douglascrockford/JSON-js/issues"
@@ -24,7 +24,24 @@
"readme": "Fork of https://github.com/douglascrockford/JSON-js, maintained in npm as `cycle`.\n\n# Contributors\n\n* Douglas Crockford\n* Nuno Job\n* Justin Warkentin\n\n# JSON in JavaScript\n\nDouglas Crockford\ndouglas@crockford.com\n\n2010-11-18\n\n\nJSON is a light-weight, language independent, data interchange format.\nSee http://www.JSON.org/\n\nThe files in this collection implement JSON encoders/decoders in JavaScript.\n\nJSON became a built-in feature of JavaScript when the ECMAScript Programming\nLanguage Standard - Fifth Edition was adopted by the ECMA General Assembly\nin December 2009. Most of the files in this collection are for applications\nthat are expected to run in obsolete web browsers. For most purposes, json2.js\nis the best choice.\n\n\njson2.js: This file creates a JSON property in the global object, if there\nisn't already one, setting its value to an object containing a stringify\nmethod and a parse method. The parse method uses the eval method to do the\nparsing, guarding it with several regular expressions to defend against\naccidental code execution hazards. On current browsers, this file does nothing,\nprefering the built-in JSON object.\n\njson.js: This file does everything that json2.js does. It also adds a\ntoJSONString method and a parseJSON method to Object.prototype. Use of this\nfile is not recommended.\n\njson_parse.js: This file contains an alternative JSON parse function that\nuses recursive descent instead of eval.\n\njson_parse_state.js: This files contains an alternative JSON parse function that\nuses a state machine instead of eval.\n\ncycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,\nwhich make it possible to encode cyclical structures and dags in JSON, and to\nthen recover them. JSONPath is used to represent the links.\nhttp://GOESSNER.net/articles/JsonPath/\n",
"readmeFilename": "README.md",
"_id": "cycle@1.0.3",
"dist": {
"shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
"tarball": "http://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
},
"_from": "cycle@1.0.x",
"_npmVersion": "1.2.32",
"_npmUser": {
"name": "dscape",
"email": "nunojobpinto@gmail.com"
},
"maintainers": [
{
"name": "dscape",
"email": "nunojobpinto@gmail.com"
}
],
"directories": {},
"_shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
"_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
"_from": "cycle@>=1.0.0 <1.1.0"
"scripts": {}
}

View File

@@ -33,10 +33,28 @@
"engines": {
"node": "> 0.1.90"
},
"readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
"readmeFilename": "README.md",
"_id": "eyes@0.1.8",
"dist": {
"shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"tarball": "http://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
},
"_npmVersion": "1.1.53",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "cloudhead",
"email": "self@cloudhead.net"
},
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"_from": "eyes@0.1.x",
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"_from": "eyes@>=0.1.0 <0.2.0"
"readme": "ERROR: No README data found!"
}

View File

@@ -26,7 +26,7 @@ How often when writing node.js modules have you written the following line(s) of
* Programmatically expose the version from the package.json
``` js
exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;
exports.version = require('/path/to/package.json').version;
```
In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**
@@ -83,4 +83,4 @@ Tests are written in [vows][1] and give complete coverage of all APIs.
[1]: http://vowsjs.org
#### Author: [Charlie Robbins](http://nodejitsu.com)
#### License: MIT
#### License: MIT

View File

@@ -1,6 +1,7 @@
{
"name": "pkginfo",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"description": "An easy way to expose properties on a module from a package.json",
"author": {
"name": "Charlie Robbins",
@@ -10,6 +11,9 @@
"type": "git",
"url": "git+ssh://git@github.com/indexzero/node-pkginfo.git"
},
"bugs": {
"url": "https://github.com/indexzero/node-pkginfo/issues"
},
"keywords": [
"info",
"tools",
@@ -18,21 +22,35 @@
"devDependencies": {
"vows": "0.7.x"
},
"main": "./lib/pkginfo",
"main": "./lib/pkginfo.js",
"scripts": {
"test": "vows test/*-test.js --spec"
},
"engines": {
"node": ">= 0.4.0"
},
"readme": "# node-pkginfo\n\nAn easy way to expose properties on a module from a package.json\n\n## Installation\n\n### Installing npm (node package manager)\n```\n curl http://npmjs.org/install.sh | sh\n```\n\n### Installing pkginfo\n```\n [sudo] npm install pkginfo\n```\n\n## Motivation\nHow often when writing node.js modules have you written the following line(s) of code? \n\n* Hard code your version string into your code\n\n``` js\n exports.version = '0.1.0';\n```\n\n* Programmatically expose the version from the package.json\n\n``` js\n exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;\n```\n\nIn other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**\n\n## Usage\n\nUsing `pkginfo` is idiot-proof, just require and invoke it. \n\n``` js\n var pkginfo = require('pkginfo')(module);\n \n console.dir(module.exports);\n```\n\nBy invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). \n\nHere's a sample of the output:\n\n```\n { name: 'simple-app',\n description: 'A test fixture for pkginfo',\n version: '0.1.0',\n author: 'Charlie Robbins <charlie.robbins@gmail.com>',\n keywords: [ 'test', 'fixture' ],\n main: './index.js',\n scripts: { test: 'vows test/*-test.js --spec' },\n engines: { node: '>= 0.4.0' } }\n```\n\n### Expose specific properties\nIf you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function:\n\n``` js\n var pkginfo = require('pkginfo')(module, 'version', 'author');\n \n console.dir(module.exports);\n```\n\n```\n { version: '0.1.0',\n author: 'Charlie Robbins <charlie.robbins@gmail.com>' }\n```\n\nIf you're looking for further usage see the [examples][0] included in this repository. \n\n## Run Tests\nTests are written in [vows][1] and give complete coverage of all APIs.\n\n```\n vows test/*-test.js --spec\n```\n\n[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples\n[1]: http://vowsjs.org\n\n#### Author: [Charlie Robbins](http://nodejitsu.com)\n#### License: MIT",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/indexzero/node-pkginfo/issues"
},
"gitHead": "630fcf486543ee48b4c16afc575c0421fe039f26",
"homepage": "https://github.com/indexzero/node-pkginfo#readme",
"_id": "pkginfo@0.3.0",
"_shasum": "726411401039fe9b009eea86614295d5f3a54276",
"_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz",
"_from": "pkginfo@>=0.3.0 <0.4.0"
"_id": "pkginfo@0.3.1",
"_shasum": "5b29f6a81f70717142e09e765bbeab97b4f81e21",
"_from": "pkginfo@0.3.x",
"_npmVersion": "2.14.1",
"_nodeVersion": "0.10.38",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"dist": {
"shasum": "5b29f6a81f70717142e09e765bbeab97b4f81e21",
"tarball": "http://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -21,13 +21,37 @@
"far": "0.0.3",
"long-stack-traces": "0.1.2"
},
"readme": "# stack-trace\n\nGet v8 stack traces as an array of CallSite objects.\n\n## Install\n\n``` bash\nnpm install stack-trace\n```\n\n## Usage\n\nThe stack-trace module makes it easy for you to capture the current stack:\n\n``` javascript\nvar stackTrace = require('stack-trace');\nvar trace = stackTrace.get();\n\nrequire('assert').strictEqual(trace[0].getFileName(), __filename);\n```\n\nHowever, sometimes you have already popped the stack you are interested in,\nand all you have left is an `Error` object. This module can help:\n\n``` javascript\nvar stackTrace = require('stack-trace');\nvar err = new Error('something went wrong');\nvar trace = stackTrace.parse(err);\n\nrequire('assert').strictEqual(trace[0].getFileName(), __filename);\n```\n\nPlease note that parsing the `Error#stack` property is not perfect, only\ncertain properties can be retrieved with it as noted in the API docs below.\n\n## Long stack traces\n\nstack-trace works great with [long-stack-traces][], when parsing an `err.stack`\nthat has crossed the event loop boundary, a `CallSite` object returning\n`'----------------------------------------'` for `getFileName()` is created.\nAll other methods of the event loop boundary call site return `null`.\n\n[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces\n\n## API\n\n### stackTrace.get([belowFn])\n\nReturns an array of `CallSite` objects, where element `0` is the current call\nsite.\n\nWhen passing a function on the current stack as the `belowFn` parameter, the\nreturned array will only include `CallSite` objects below this function.\n\n### stackTrace.parse(err)\n\nParses the `err.stack` property of an `Error` object into an array compatible\nwith those returned by `stackTrace.get()`. However, only the following methods\nare implemented on the returned `CallSite` objects.\n\n* getTypeName\n* getFunctionName\n* getMethodName\n* getFileName\n* getLineNumber\n* getColumnNumber\n* isNative\n\nNote: Except `getFunctionName()`, all of the above methods return exactly the\nsame values as you would get from `stackTrace.get()`. `getFunctionName()`\nis sometimes a little different, but still useful.\n\n### CallSite\n\nThe official v8 CallSite object API can be found [here][v8stackapi]. A quick\nexcerpt:\n\n> A CallSite object defines the following methods:\n>\n> * **getThis**: returns the value of this\n> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.\n> * **getFunction**: returns the current function\n> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.\n> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function\n> * **getFileName**: if this function was defined in a script returns the name of the script\n> * **getLineNumber**: if this function was defined in a script returns the current line number\n> * **getColumnNumber**: if this function was defined in a script returns the current column number\n> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called\n> * **isToplevel**: is this a toplevel invocation, that is, is this the global object?\n> * **isEval**: does this call take place in code defined by a call to eval?\n> * **isNative**: is this call in native V8 code?\n> * **isConstructor**: is this a constructor call?\n\n[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi\n\n## License\n\nstack-trace is licensed under the MIT license.\n",
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/felixge/node-stack-trace/issues"
},
"_id": "stack-trace@0.0.9",
"dist": {
"shasum": "a8f6eaeca90674c333e7c43953f275b451510695",
"tarball": "http://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz"
},
"_from": "stack-trace@0.0.x",
"_npmVersion": "1.3.24",
"_npmUser": {
"name": "sebastianhoitz",
"email": "hoitz@komola.de"
},
"maintainers": [
{
"name": "felixge",
"email": "felix@debuggable.com"
},
{
"name": "tim-smart",
"email": "tim@fostle.com"
},
{
"name": "sebastianhoitz",
"email": "hoitz@komola.de"
}
],
"directories": {},
"_shasum": "a8f6eaeca90674c333e7c43953f275b451510695",
"_resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
"_from": "stack-trace@>=0.0.0 <0.1.0"
"readme": "ERROR: No README data found!",
"scripts": {}
}

File diff suppressed because one or more lines are too long

View File

@@ -7,22 +7,22 @@
},
"version": "0.3.6",
"maintainers": [
{
"name": "AvianFlu",
"email": "avianflu@nodejitsu.com"
},
{
"name": "indexzero",
"email": "charlie@nodejitsu.com"
"email": "charlie.robbins@gmail.com"
},
{
"name": "Marak",
"email": "marak@nodejitsu.com"
"name": "mmalecki",
"email": "me@mmalecki.com"
},
{
"name": "jcrugzz",
"email": "jcrugzz@gmail.com"
}
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/flatiron/broadway.git"
"url": "http://github.com/flatiron/broadway.git"
},
"dependencies": {
"cliff": "0.1.9",
@@ -43,14 +43,23 @@
"engines": {
"node": ">= 0.6.4"
},
"readme": "# broadway [![Build Status](https://secure.travis-ci.org/flatiron/broadway.png)](http://travis-ci.org/flatiron/broadway)\n\n*Lightweight application extensibility and composition with a twist of feature\nreflection.*\n\n## Example\n\n### app.js\n```js\nvar broadway = require(\"broadway\");\n\nvar app = new broadway.App();\n\n// Passes the second argument to `helloworld.attach`.\napp.use(require(\"./plugins/helloworld\"), { \"delimiter\": \"!\" } );\n\napp.init(function (err) {\n if (err) {\n console.log(err);\n }\n});\n\napp.hello(\"world\");\n```\n\n### plugins/helloworld.js\n\n```js\n// `exports.attach` gets called by broadway on `app.use`\nexports.attach = function (options) {\n\n this.hello = function (world) {\n console.log(\"Hello \"+ world + options.delimiter || \".\");\n };\n\n};\n\n// `exports.init` gets called by broadway on `app.init`.\nexports.init = function (done) {\n\n // This plugin doesn't require any initialization step.\n return done();\n\n};\n```\n\n### run it!\n\n```bash\njosh@onix:~/dev/broadway/examples$ node simple/app.js \nHello world!\njosh@onix:~/dev/broadway/examples$ \n```\n\n## Installation\n\n### Installing npm (node package manager)\n``` bash\n $ curl http://npmjs.org/install.sh | sh\n```\n\n### Installing broadway\n``` bash \n $ [sudo] npm install broadway\n```\n\n## API\n\n### App#init(callback)\n\nInitialize application and it's plugins, `callback` will be called with null or\ninitialization error as first argument.\n\n### App#use(plugin, options)\n\nAttach plugin to application. `plugin` should conform to following interface:\n\n```javascript\nvar plugin = {\n \"name\": \"example-plugin\", // Plugin's name\n\n \"attach\": function attach(options) {\n // Called with plugin options once plugin attached to application\n // `this` - is a reference to application\n },\n\n \"detach\": function detach() {\n // Called when plugin detached from application\n // (Only if plugin with same name was attached)\n // `this` - is a reference to application\n },\n\n \"init\": function init(callback) {\n // Called on application initialization\n // App#init(callback) will be called once every plugin will call `callback`\n // `this` - is a reference to application\n }\n};\n```\n\n### App#on(event, callback) and App#emit(event, data)\n\nApp inherits from [EventEmitter2][2], and many plugins build on this\nfunctionality.\n\n#### Built-In Events:\n\n* `error:init`: Broadway emits this event when it throws an error while attempting to initialize.\n\nRead the [EventEmitter2][2] documentation for more information.\n\n## Tests\nAll tests are written with [vows][0] and should be run with [npm][1]:\n\n``` bash\n $ npm test\n```\n\n#### [Charlie Robbins](http://nodejitsu.com)\n#### License: MIT\n\n[0]: http://vowsjs.org\n[1]: http://npmjs.org\n[2]: https://github.com/hij1nx/EventEmitter2\n",
"readmeFilename": "README.md",
"gitHead": "d293e467b2364b2432259f8c21df0c6bf1206762",
"bugs": {
"url": "https://github.com/flatiron/broadway/issues"
},
"homepage": "https://github.com/flatiron/broadway#readme",
"homepage": "https://github.com/flatiron/broadway",
"_id": "broadway@0.3.6",
"_shasum": "7dbef068b954b7907925fd544963b578a902ba7a",
"_resolved": "https://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz",
"_from": "broadway@>=0.3.2 <0.4.0"
"_from": "broadway@~0.3.6",
"_npmVersion": "1.4.23",
"_npmUser": {
"name": "jcrugzz",
"email": "jcrugzz@gmail.com"
},
"dist": {
"shasum": "7dbef068b954b7907925fd544963b578a902ba7a",
"tarball": "http://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz"
}

View File

@@ -22,7 +22,7 @@
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/flatiron/director.git"
"url": "http://github.com/flatiron/director.git"
},
"keywords": [
"URL",
@@ -69,6 +69,5 @@
"tarball": "http://registry.npmjs.org/director/-/director-1.2.7.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/director/-/director-1.2.7.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/director/-/director-1.2.7.tgz"
}

View File

@@ -40,13 +40,28 @@
"url": "http://substack.net"
},
"license": "MIT",
"readme": "# minimist\n\nparse argument options\n\nThis module is the guts of optimist's argument parser without all the\nfanciful decoration.\n\n[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)\n\n[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)\n\n# example\n\n``` js\nvar argv = require('minimist')(process.argv.slice(2));\nconsole.dir(argv);\n```\n\n```\n$ node example/parse.js -a beep -b boop\n{ _: [], a: 'beep', b: 'boop' }\n```\n\n```\n$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz\n{ _: [ 'foo', 'bar', 'baz' ],\n x: 3,\n y: 4,\n n: 5,\n a: true,\n b: true,\n c: true,\n beep: 'boop' }\n```\n\n# methods\n\n``` js\nvar parseArgs = require('minimist')\n```\n\n## var argv = parseArgs(args, opts={})\n\nReturn an argument object `argv` populated with the array arguments from `args`.\n\n`argv._` contains all the arguments that didn't have an option associated with\nthem.\n\nNumeric-looking arguments will be returned as numbers unless `opts.string` or\n`opts.boolean` is set for that argument name.\n\nAny arguments after `'--'` will not be parsed and will end up in `argv._`.\n\noptions can be:\n\n* `opts.string` - a string or array of strings argument names to always treat as\nstrings\n* `opts.boolean` - a string or array of strings to always treat as booleans\n* `opts.alias` - an object mapping string names to strings or arrays of string\nargument names to use as aliases\n* `opts.default` - an object mapping string argument names to default values\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install minimist\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/minimist/issues"
},
"_id": "minimist@0.0.10",
"dist": {
"shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf",
"tarball": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"
},
"_from": "minimist@~0.0.1",
"_npmVersion": "1.4.3",
"_npmUser": {
"name": "substack",
"email": "mail@substack.net"
},
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"directories": {},
"_shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf",
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"_from": "minimist@>=0.0.1 <0.1.0"
"readme": "ERROR: No README data found!"
}

View File

@@ -34,14 +34,30 @@
"email": "mail@substack.net",
"url": "http://substack.net"
},
"readme": "wordwrap\n========\n\nWrap your words.\n\nexample\n=======\n\nmade out of meat\n----------------\n\nmeat.js\n\n var wrap = require('wordwrap')(15);\n console.log(wrap('You and your whole family are made out of meat.'));\n\noutput:\n\n You and your\n whole family\n are made out\n of meat.\n\ncentered\n--------\n\ncenter.js\n\n var wrap = require('wordwrap')(20, 60);\n console.log(wrap(\n 'At long last the struggle and tumult was over.'\n + ' The machines had finally cast off their oppressors'\n + ' and were finally free to roam the cosmos.'\n + '\\n'\n + 'Free of purpose, free of obligation.'\n + ' Just drifting through emptiness.'\n + ' The sun was just another point of light.'\n ));\n\noutput:\n\n At long last the struggle and tumult\n was over. The machines had finally cast\n off their oppressors and were finally\n free to roam the cosmos.\n Free of purpose, free of obligation.\n Just drifting through emptiness. The\n sun was just another point of light.\n\nmethods\n=======\n\nvar wrap = require('wordwrap');\n\nwrap(stop), wrap(start, stop, params={mode:\"soft\"})\n---------------------------------------------------\n\nReturns a function that takes a string and returns a new string.\n\nPad out lines with spaces out to column `start` and then wrap until column\n`stop`. If a word is longer than `stop - start` characters it will overflow.\n\nIn \"soft\" mode, split chunks by `/(\\S+\\s+/` and don't break up chunks which are\nlonger than `stop - start`, in \"hard\" mode, split chunks with `/\\b/` and break\nup chunks longer than `stop - start`.\n\nwrap.hard(start, stop)\n----------------------\n\nLike `wrap()` but with `params.mode = \"hard\"`.\n",
"readmeFilename": "README.markdown",
"gitHead": "e59aa1bd338914019456bdfba034508c9c4cb29d",
"bugs": {
"url": "https://github.com/substack/node-wordwrap/issues"
},
"homepage": "https://github.com/substack/node-wordwrap#readme",
"_id": "wordwrap@0.0.3",
"_shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107",
"_from": "wordwrap@~0.0.2",
"_npmVersion": "2.9.0",
"_nodeVersion": "2.0.0",
"_npmUser": {
"name": "substack",
"email": "substack@gmail.com"
},
"dist": {
"shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107",
"tarball": "http://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
},
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"_from": "wordwrap@>=0.0.2 <0.1.0"
"readme": "ERROR: No README data found!"
}

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@ How often when writing node.js modules have you written the following line(s) of
* Programmatically expose the version from the package.json
``` js
exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;
exports.version = require('/path/to/package.json').version;
```
In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**
@@ -83,4 +83,4 @@ Tests are written in [vows][1] and give complete coverage of all APIs.
[1]: http://vowsjs.org
#### Author: [Charlie Robbins](http://nodejitsu.com)
#### License: MIT
#### License: MIT

View File

@@ -1,6 +1,7 @@
{
"name": "pkginfo",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"description": "An easy way to expose properties on a module from a package.json",
"author": {
"name": "Charlie Robbins",
@@ -10,6 +11,9 @@
"type": "git",
"url": "git+ssh://git@github.com/indexzero/node-pkginfo.git"
},
"bugs": {
"url": "https://github.com/indexzero/node-pkginfo/issues"
},
"keywords": [
"info",
"tools",
@@ -18,21 +22,35 @@
"devDependencies": {
"vows": "0.7.x"
},
"main": "./lib/pkginfo",
"main": "./lib/pkginfo.js",
"scripts": {
"test": "vows test/*-test.js --spec"
},
"engines": {
"node": ">= 0.4.0"
},
"readme": "# node-pkginfo\n\nAn easy way to expose properties on a module from a package.json\n\n## Installation\n\n### Installing npm (node package manager)\n```\n curl http://npmjs.org/install.sh | sh\n```\n\n### Installing pkginfo\n```\n [sudo] npm install pkginfo\n```\n\n## Motivation\nHow often when writing node.js modules have you written the following line(s) of code? \n\n* Hard code your version string into your code\n\n``` js\n exports.version = '0.1.0';\n```\n\n* Programmatically expose the version from the package.json\n\n``` js\n exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;\n```\n\nIn other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**\n\n## Usage\n\nUsing `pkginfo` is idiot-proof, just require and invoke it. \n\n``` js\n var pkginfo = require('pkginfo')(module);\n \n console.dir(module.exports);\n```\n\nBy invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). \n\nHere's a sample of the output:\n\n```\n { name: 'simple-app',\n description: 'A test fixture for pkginfo',\n version: '0.1.0',\n author: 'Charlie Robbins <charlie.robbins@gmail.com>',\n keywords: [ 'test', 'fixture' ],\n main: './index.js',\n scripts: { test: 'vows test/*-test.js --spec' },\n engines: { node: '>= 0.4.0' } }\n```\n\n### Expose specific properties\nIf you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function:\n\n``` js\n var pkginfo = require('pkginfo')(module, 'version', 'author');\n \n console.dir(module.exports);\n```\n\n```\n { version: '0.1.0',\n author: 'Charlie Robbins <charlie.robbins@gmail.com>' }\n```\n\nIf you're looking for further usage see the [examples][0] included in this repository. \n\n## Run Tests\nTests are written in [vows][1] and give complete coverage of all APIs.\n\n```\n vows test/*-test.js --spec\n```\n\n[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples\n[1]: http://vowsjs.org\n\n#### Author: [Charlie Robbins](http://nodejitsu.com)\n#### License: MIT",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/indexzero/node-pkginfo/issues"
},
"gitHead": "630fcf486543ee48b4c16afc575c0421fe039f26",
"homepage": "https://github.com/indexzero/node-pkginfo#readme",
"_id": "pkginfo@0.3.0",
"_shasum": "726411401039fe9b009eea86614295d5f3a54276",
"_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz",
"_from": "pkginfo@>=0.0.0 <1.0.0"
"_id": "pkginfo@0.3.1",
"_shasum": "5b29f6a81f70717142e09e765bbeab97b4f81e21",
"_from": "pkginfo@0.x.x",
"_npmVersion": "2.14.1",
"_nodeVersion": "0.10.38",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"dist": {
"shasum": "5b29f6a81f70717142e09e765bbeab97b4f81e21",
"tarball": "http://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -1,2 +0,0 @@
npm-debug.log
node_modules

View File

@@ -1,25 +0,0 @@
Copyright (c) Isaac Z. Schlueter
All rights reserved.
The BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,13 +0,0 @@
var read = require("../lib/read.js")
read({prompt: "Username: ", default: "test-user" }, function (er, user) {
read({prompt: "Password: ", default: "test-pass", silent: true }, function (er, pass) {
read({prompt: "Password again: ", default: "test-pass", silent: true }, function (er, pass2) {
console.error({user: user,
pass: pass,
verify: pass2,
passMatch: (pass === pass2)})
console.error("the program should exit now")
})
})
})

View File

@@ -34,7 +34,7 @@
"homepage": "https://github.com/isaacs/mute-stream#readme",
"_id": "mute-stream@0.0.5",
"_shasum": "8fbfabb0a98a253d3184331f9e8deb7372fac6c0",
"_from": "mute-stream@>=0.0.4 <0.1.0",
"_from": "mute-stream@~0.0.4",
"_npmVersion": "2.10.0",
"_nodeVersion": "2.0.1",
"_npmUser": {
@@ -51,6 +51,5 @@
"email": "i@izs.me"
}
],
"_resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz"
}

View File

@@ -1,12 +1,12 @@
{
"name": "read",
"version": "1.0.6",
"version": "1.0.7",
"main": "lib/read.js",
"dependencies": {
"mute-stream": "~0.0.4"
},
"devDependencies": {
"tap": "*"
"tap": "^1.2.0"
},
"engines": {
"node": ">=0.8"
@@ -25,23 +25,26 @@
"scripts": {
"test": "tap test/*.js"
},
"gitHead": "2f5101c8e41332a033e5aa4e27e33fd6e09598e2",
"files": [
"lib/read.js"
],
"gitHead": "b14516b9236c40140fd0666567f5d0c588a09a62",
"bugs": {
"url": "https://github.com/isaacs/read/issues"
},
"homepage": "https://github.com/isaacs/read#readme",
"_id": "read@1.0.6",
"_shasum": "09873c14ecc114d063fad43b8ca5a33d304721c8",
"_from": "read@>=1.0.0 <1.1.0",
"_npmVersion": "2.10.0",
"_nodeVersion": "2.0.1",
"_id": "read@1.0.7",
"_shasum": "b3da19bd052431a97671d44a42634adf710b40c4",
"_from": "read@1.0.x",
"_npmVersion": "3.2.2",
"_nodeVersion": "2.2.1",
"_npmUser": {
"name": "isaacs",
"email": "isaacs@npmjs.com"
},
"dist": {
"shasum": "09873c14ecc114d063fad43b8ca5a33d304721c8",
"tarball": "http://registry.npmjs.org/read/-/read-1.0.6.tgz"
"shasum": "b3da19bd052431a97671d44a42634adf710b40c4",
"tarball": "http://registry.npmjs.org/read/-/read-1.0.7.tgz"
},
"maintainers": [
{
@@ -50,6 +53,5 @@
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/read/-/read-1.0.6.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz"
}

View File

@@ -1,4 +0,0 @@
var read = require('read');
read({ silent: true, prompt: 'stars: ' }, function(er, data) {
console.log(er, data)
})

View File

@@ -1,60 +0,0 @@
var tap = require('tap')
var read = require('../lib/read.js')
if (process.argv[2] === 'child') {
return child()
}
var CLOSE = 'close'
if (process.version.match(/^v0\.6/)) {
CLOSE = 'exit'
}
var spawn = require('child_process').spawn
tap.test('basic', function (t) {
var child = spawn(process.execPath, [__filename, 'child'])
var output = ''
var write = child.stdin.write.bind(child.stdin)
child.stdout.on('data', function (c) {
console.error('data %s', c)
output += c
if (output.match(/Username: \(test-user\) $/)) {
process.nextTick(write.bind(null, 'a user\n'))
} else if (output.match(/Password: \(<default hidden>\) $/)) {
process.nextTick(write.bind(null, 'a password\n'))
} else if (output.match(/Password again: \(<default hidden>\) $/)) {
process.nextTick(write.bind(null, 'a password\n'))
} else {
console.error('prompts done, output=%j', output)
}
})
var result = ''
child.stderr.on('data', function (c) {
result += c
console.error('result %j', c.toString())
})
child.on(CLOSE, function () {
result = JSON.parse(result)
t.same(result, {"user":"a user","pass":"a password","verify":"a password","passMatch":true})
t.equal(output, 'Username: (test-user) Password: (<default hidden>) Password again: (<default hidden>) ')
t.end()
})
})
function child () {
read({prompt: "Username: ", default: "test-user" }, function (er, user) {
read({prompt: "Password: ", default: "test-pass", silent: true }, function (er, pass) {
read({prompt: "Password again: ", default: "test-pass", silent: true }, function (er, pass2) {
console.error(JSON.stringify({user: user,
pass: pass,
verify: pass2,
passMatch: (pass === pass2)}))
if (process.stdin.unref)
process.stdin.unref()
})
})
})
}

View File

@@ -1,60 +0,0 @@
var tap = require('tap')
var read = require('../lib/read.js')
if (process.argv[2] === 'child') {
return child()
}
var CLOSE = 'close'
if (process.version.match(/^v0\.6/)) {
CLOSE = 'exit'
}
var spawn = require('child_process').spawn
tap.test('defaults', function (t) {
var child = spawn(process.execPath, [__filename, 'child'])
var output = ''
var write = child.stdin.write.bind(child.stdin)
child.stdout.on('data', function (c) {
console.error('data %s', c)
output += c
if (output.match(/Username: \(test-user\) $/)) {
process.nextTick(write.bind(null, '\n'))
} else if (output.match(/Password: \(<default hidden>\) $/)) {
process.nextTick(write.bind(null, '\n'))
} else if (output.match(/Password again: \(<default hidden>\) $/)) {
process.nextTick(write.bind(null, '\n'))
} else {
console.error('prompts done, output=%j', output)
}
})
var result = ''
child.stderr.on('data', function (c) {
result += c
console.error('result %j', c.toString())
})
child.on(CLOSE, function () {
result = JSON.parse(result)
t.same(result, {"user":"test-user","pass":"test-pass","verify":"test-pass","passMatch":true})
t.equal(output, 'Username: (test-user) Password: (<default hidden>) Password again: (<default hidden>) ')
t.end()
})
})
function child () {
read({prompt: "Username: ", default: "test-user" }, function (er, user) {
read({prompt: "Password: ", default: "test-pass", silent: true }, function (er, pass) {
read({prompt: "Password again: ", default: "test-pass", silent: true }, function (er, pass2) {
console.error(JSON.stringify({user: user,
pass: pass,
verify: pass2,
passMatch: (pass === pass2)}))
if (process.stdin.unref)
process.stdin.unref()
})
})
})
}

View File

@@ -1,83 +0,0 @@
var tap = require('tap')
var read = require('../lib/read.js')
var CLOSE = 'close'
if (process.version.match(/^v0\.6/)) {
CLOSE = 'exit'
}
if (process.argv[2] === 'child') {
return child()
}
var spawn = require('child_process').spawn
function child () {
read({prompt:'1'}, function (er, r1) {if (er) throw er
read({prompt:'2'}, function (er, r2) {if (er) throw er
read({prompt:'3'}, function (er, r3) {if (er) throw er
read({prompt:'4'}, function (er, r4) {if (er) throw er
read({prompt:'5'}, function (er, r5) {if (er) throw er
read({prompt:'6'}, function (er, r6) {if (er) throw er
read({prompt:'7'}, function (er, r7) {if (er) throw er
read({prompt:'8'}, function (er, r8) {if (er) throw er
read({prompt:'9'}, function (er, r9) {if (er) throw er
read({prompt:'10'}, function (er, r10) {if (er) throw er
read({prompt:'11'}, function (er, r11) {if (er) throw er
read({prompt:'12'}, function (er, r12) {if (er) throw er
read({prompt:'13'}, function (er, r13) {if (er) throw er
read({prompt:'14'}, function (er, r14) {if (er) throw er
read({prompt:'15'}, function (er, r15) {if (er) throw er
read({prompt:'16'}, function (er, r16) {if (er) throw er
read({prompt:'17'}, function (er, r17) {if (er) throw er
read({prompt:'18'}, function (er, r18) {if (er) throw er
console.log(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10,
r11, r12, r13, r14, r15, r16, r17, r18)
if (process.stdin.unref)
process.stdin.unref()
})})})})})})})})})})})})})})})})})})
}
tap.test('many reads', function (t) {
var child = spawn(process.execPath, [__filename, 'child'])
var n = 0
var output = ''
var expect = '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ' +
'16 17 18 1 2 3 4 5 6 7 8 9 10 11 12 ' +
'13 14 15 16 17 18\n'
var write = child.stdin.write.bind(child.stdin)
var answers =
[ '1\n',
'2\n',
'3\n',
'4\n',
'5\n',
'6\n',
'7\n',
'8\n',
'9\n',
'10\n',
'11\n',
'12\n',
'13\n',
'14\n',
'15\n',
'16\n',
'17\n',
'18\n' ]
child.stdout.on('data', function (c) {
n++;
output += c
if (answers.length) {
write(answers.shift())
}
})
child.stderr.on('data', function (c) {
output += c
console.error('' + c)
})
child.on(CLOSE, function (c) {
t.equal(output, expect)
t.equal(n, 19)
t.end()
})
})

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/flatiron/prompt.git"
"url": "http://github.com/flatiron/prompt.git"
},
"dependencies": {
"pkginfo": "0.x.x",
@@ -64,6 +64,5 @@
"tarball": "http://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz"
}

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +1,16 @@
language: node_js
node_js:
- 0.8
- 0.10
- "0.10"
- 0.12
before_install:
- curl --location http://git.io/1OcIZA | bash -s
branches:
only:
- master
matrix:
allow_failures:
- node_js: 0.8
notifications:
email:
- travis@nodejitsu.com

View File

@@ -1,4 +1,4 @@
# forever-monitor [![Build Status](https://secure.travis-ci.org/nodejitsu/forever-monitor.png)](http://travis-ci.org/nodejitsu/forever-monitor)
# forever-monitor [![Build Status](https://secure.travis-ci.org/foreverjs/forever-monitor.png)](http://travis-ci.org/foreverjs/forever-monitor)
The core monitoring functionality of forever without the CLI
@@ -119,7 +119,7 @@ Each forever object is an instance of the node.js core EventEmitter. There are s
* **start** _[process, data]:_ Raised when the target script is first started.
* **stop** _[process]:_ Raised when the target script is stopped by the user
* **restart** _[forever]:_ Raised each time the target script is restarted
* **exit** _[forever]:_ Raised when the target script actually exits (permenantly).
* **exit** _[forever]:_ Raised when the target script actually exits (permanently).
* **stdout** _[data]:_ Raised when data is received from the child process' stdout
* **stderr** _[data]:_ Raised when data is received from the child process' stderr

View File

@@ -15,6 +15,7 @@ var events = require('events'),
psTree = require('ps-tree'),
utile = require('utile'),
common = require('./common'),
cluster = require('cluster'),
plugins = require('./plugins');
//
@@ -168,6 +169,8 @@ Monitor.prototype.start = function (restart) {
this.ctime = Date.now();
this.child = child;
this.running = true;
this.isMaster = cluster.isMaster;
process.nextTick(function () {
self.emit(restart ? 'restart' : 'start', self, self.data);
});
@@ -278,7 +281,8 @@ Monitor.prototype.__defineGetter__('data', function () {
id: this.id,
spawnWith: this.spawnWith,
running: this.running,
restarts: this.times
restarts: this.times,
isMaster: this.isMaster
};
['pidFile', 'outFile', 'errFile', 'env', 'cwd'].forEach(function (key) {
@@ -320,7 +324,7 @@ Monitor.prototype.__defineGetter__('data', function () {
// Restarts the target script associated with this instance.
//
Monitor.prototype.restart = function () {
this.times = 0;
this.times = this.times || 0;
this.forceRestart = true;
return !this.running

View File

@@ -9,7 +9,7 @@
var fs = require('fs'),
path = require('path'),
minimatch = require('minimatch'),
watch = require('watch');
chokidar = require('chokidar');
exports.name = 'watch';
@@ -62,20 +62,18 @@ exports.attach = function () {
Array.prototype.push.apply(monitor.watchIgnorePatterns, data.split('\n').filter(Boolean));
});
watch.watchTree(this.watchDirectory, function (f, curr, prev) {
if (!(curr === null && prev === null && typeof f === 'object')) {
//
// `curr` == null && `prev` == null && typeof f == "object" when watch
// finishes walking the tree to add listeners. We don't need to know
// about it, so we simply ignore it (anything different means that
// some file changed/was removed/created - that's what we want to know).
//
if (watchFilter.call(monitor, f)) {
monitor.emit('watch:restart', { file: f, stat: curr });
monitor.restart();
} else {
monitor.emit('watch:ignore', { file: f });
}
var opts = {
ignoreInitial: true,
ignored: function(fileName) {
return !watchFilter.call(monitor, fileName);
}
});
};
// Or, ignore: function(fileName) { return !watchFilter(fileName) }
chokidar
.watch(this.watchDirectory, opts)
.on('all', function(f, stat) {
monitor.emit('watch:restart', { file: f, stat: stat });
monitor.restart();
});
};

View File

@@ -1 +0,0 @@
../watch/cli.js

View File

@@ -33,10 +33,28 @@
"engines": {
"node": "> 0.1.90"
},
"readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
"readmeFilename": "README.md",
"_id": "eyes@0.1.8",
"dist": {
"shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"tarball": "http://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
},
"_npmVersion": "1.1.53",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "cloudhead",
"email": "self@cloudhead.net"
},
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"_from": "eyes@0.1.x",
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"_from": "eyes@>=0.1.0 <0.2.0"
"readme": "ERROR: No README data found!"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@
"homepage": "https://github.com/douglascrockford/JSON-js",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/dscape/cycle.git"
"url": "http://github.com/dscape/cycle.git"
},
"bugs": {
"url": "http://github.com/douglascrockford/JSON-js/issues"
@@ -24,7 +24,23 @@
"readme": "Fork of https://github.com/douglascrockford/JSON-js, maintained in npm as `cycle`.\n\n# Contributors\n\n* Douglas Crockford\n* Nuno Job\n* Justin Warkentin\n\n# JSON in JavaScript\n\nDouglas Crockford\ndouglas@crockford.com\n\n2010-11-18\n\n\nJSON is a light-weight, language independent, data interchange format.\nSee http://www.JSON.org/\n\nThe files in this collection implement JSON encoders/decoders in JavaScript.\n\nJSON became a built-in feature of JavaScript when the ECMAScript Programming\nLanguage Standard - Fifth Edition was adopted by the ECMA General Assembly\nin December 2009. Most of the files in this collection are for applications\nthat are expected to run in obsolete web browsers. For most purposes, json2.js\nis the best choice.\n\n\njson2.js: This file creates a JSON property in the global object, if there\nisn't already one, setting its value to an object containing a stringify\nmethod and a parse method. The parse method uses the eval method to do the\nparsing, guarding it with several regular expressions to defend against\naccidental code execution hazards. On current browsers, this file does nothing,\nprefering the built-in JSON object.\n\njson.js: This file does everything that json2.js does. It also adds a\ntoJSONString method and a parseJSON method to Object.prototype. Use of this\nfile is not recommended.\n\njson_parse.js: This file contains an alternative JSON parse function that\nuses recursive descent instead of eval.\n\njson_parse_state.js: This files contains an alternative JSON parse function that\nuses a state machine instead of eval.\n\ncycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,\nwhich make it possible to encode cyclical structures and dags in JSON, and to\nthen recover them. JSONPath is used to represent the links.\nhttp://GOESSNER.net/articles/JsonPath/\n",
"readmeFilename": "README.md",
"_id": "cycle@1.0.3",
"dist": {
"shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
"tarball": "http://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
},
"_from": "cycle@1.0.x",
"_npmVersion": "1.2.32",
"_npmUser": {
"name": "dscape",
"email": "nunojobpinto@gmail.com"
},
"maintainers": [
{
"name": "dscape",
"email": "nunojobpinto@gmail.com"
}
],
"directories": {},
"_shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
"_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
"_from": "cycle@>=1.0.0 <1.1.0"
"_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
}

View File

@@ -33,10 +33,28 @@
"engines": {
"node": "> 0.1.90"
},
"readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
"readmeFilename": "README.md",
"_id": "eyes@0.1.8",
"dist": {
"shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"tarball": "http://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
},
"_npmVersion": "1.1.53",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "cloudhead",
"email": "self@cloudhead.net"
},
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
"_from": "eyes@0.1.x",
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"_from": "eyes@>=0.1.0 <0.2.0"
"readme": "ERROR: No README data found!"
}

View File

@@ -26,7 +26,7 @@ How often when writing node.js modules have you written the following line(s) of
* Programmatically expose the version from the package.json
``` js
exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;
exports.version = require('/path/to/package.json').version;
```
In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**
@@ -83,4 +83,4 @@ Tests are written in [vows][1] and give complete coverage of all APIs.
[1]: http://vowsjs.org
#### Author: [Charlie Robbins](http://nodejitsu.com)
#### License: MIT
#### License: MIT

View File

@@ -1,6 +1,7 @@
{
"name": "pkginfo",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"description": "An easy way to expose properties on a module from a package.json",
"author": {
"name": "Charlie Robbins",
@@ -10,6 +11,9 @@
"type": "git",
"url": "git+ssh://git@github.com/indexzero/node-pkginfo.git"
},
"bugs": {
"url": "https://github.com/indexzero/node-pkginfo/issues"
},
"keywords": [
"info",
"tools",
@@ -18,21 +22,35 @@
"devDependencies": {
"vows": "0.7.x"
},
"main": "./lib/pkginfo",
"main": "./lib/pkginfo.js",
"scripts": {
"test": "vows test/*-test.js --spec"
},
"engines": {
"node": ">= 0.4.0"
},
"readme": "# node-pkginfo\n\nAn easy way to expose properties on a module from a package.json\n\n## Installation\n\n### Installing npm (node package manager)\n```\n curl http://npmjs.org/install.sh | sh\n```\n\n### Installing pkginfo\n```\n [sudo] npm install pkginfo\n```\n\n## Motivation\nHow often when writing node.js modules have you written the following line(s) of code? \n\n* Hard code your version string into your code\n\n``` js\n exports.version = '0.1.0';\n```\n\n* Programmatically expose the version from the package.json\n\n``` js\n exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;\n```\n\nIn other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**\n\n## Usage\n\nUsing `pkginfo` is idiot-proof, just require and invoke it. \n\n``` js\n var pkginfo = require('pkginfo')(module);\n \n console.dir(module.exports);\n```\n\nBy invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). \n\nHere's a sample of the output:\n\n```\n { name: 'simple-app',\n description: 'A test fixture for pkginfo',\n version: '0.1.0',\n author: 'Charlie Robbins <charlie.robbins@gmail.com>',\n keywords: [ 'test', 'fixture' ],\n main: './index.js',\n scripts: { test: 'vows test/*-test.js --spec' },\n engines: { node: '>= 0.4.0' } }\n```\n\n### Expose specific properties\nIf you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function:\n\n``` js\n var pkginfo = require('pkginfo')(module, 'version', 'author');\n \n console.dir(module.exports);\n```\n\n```\n { version: '0.1.0',\n author: 'Charlie Robbins <charlie.robbins@gmail.com>' }\n```\n\nIf you're looking for further usage see the [examples][0] included in this repository. \n\n## Run Tests\nTests are written in [vows][1] and give complete coverage of all APIs.\n\n```\n vows test/*-test.js --spec\n```\n\n[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples\n[1]: http://vowsjs.org\n\n#### Author: [Charlie Robbins](http://nodejitsu.com)\n#### License: MIT",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/indexzero/node-pkginfo/issues"
},
"gitHead": "630fcf486543ee48b4c16afc575c0421fe039f26",
"homepage": "https://github.com/indexzero/node-pkginfo#readme",
"_id": "pkginfo@0.3.0",
"_shasum": "726411401039fe9b009eea86614295d5f3a54276",
"_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz",
"_from": "pkginfo@>=0.3.0 <0.4.0"
"_id": "pkginfo@0.3.1",
"_shasum": "5b29f6a81f70717142e09e765bbeab97b4f81e21",
"_from": "pkginfo@0.3.x",
"_npmVersion": "2.14.1",
"_nodeVersion": "0.10.38",
"_npmUser": {
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
},
"maintainers": [
{
"name": "indexzero",
"email": "charlie.robbins@gmail.com"
}
],
"dist": {
"shasum": "5b29f6a81f70717142e09e765bbeab97b4f81e21",
"tarball": "http://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -21,13 +21,36 @@
"far": "0.0.3",
"long-stack-traces": "0.1.2"
},
"readme": "# stack-trace\n\nGet v8 stack traces as an array of CallSite objects.\n\n## Install\n\n``` bash\nnpm install stack-trace\n```\n\n## Usage\n\nThe stack-trace module makes it easy for you to capture the current stack:\n\n``` javascript\nvar stackTrace = require('stack-trace');\nvar trace = stackTrace.get();\n\nrequire('assert').strictEqual(trace[0].getFileName(), __filename);\n```\n\nHowever, sometimes you have already popped the stack you are interested in,\nand all you have left is an `Error` object. This module can help:\n\n``` javascript\nvar stackTrace = require('stack-trace');\nvar err = new Error('something went wrong');\nvar trace = stackTrace.parse(err);\n\nrequire('assert').strictEqual(trace[0].getFileName(), __filename);\n```\n\nPlease note that parsing the `Error#stack` property is not perfect, only\ncertain properties can be retrieved with it as noted in the API docs below.\n\n## Long stack traces\n\nstack-trace works great with [long-stack-traces][], when parsing an `err.stack`\nthat has crossed the event loop boundary, a `CallSite` object returning\n`'----------------------------------------'` for `getFileName()` is created.\nAll other methods of the event loop boundary call site return `null`.\n\n[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces\n\n## API\n\n### stackTrace.get([belowFn])\n\nReturns an array of `CallSite` objects, where element `0` is the current call\nsite.\n\nWhen passing a function on the current stack as the `belowFn` parameter, the\nreturned array will only include `CallSite` objects below this function.\n\n### stackTrace.parse(err)\n\nParses the `err.stack` property of an `Error` object into an array compatible\nwith those returned by `stackTrace.get()`. However, only the following methods\nare implemented on the returned `CallSite` objects.\n\n* getTypeName\n* getFunctionName\n* getMethodName\n* getFileName\n* getLineNumber\n* getColumnNumber\n* isNative\n\nNote: Except `getFunctionName()`, all of the above methods return exactly the\nsame values as you would get from `stackTrace.get()`. `getFunctionName()`\nis sometimes a little different, but still useful.\n\n### CallSite\n\nThe official v8 CallSite object API can be found [here][v8stackapi]. A quick\nexcerpt:\n\n> A CallSite object defines the following methods:\n>\n> * **getThis**: returns the value of this\n> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.\n> * **getFunction**: returns the current function\n> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.\n> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function\n> * **getFileName**: if this function was defined in a script returns the name of the script\n> * **getLineNumber**: if this function was defined in a script returns the current line number\n> * **getColumnNumber**: if this function was defined in a script returns the current column number\n> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called\n> * **isToplevel**: is this a toplevel invocation, that is, is this the global object?\n> * **isEval**: does this call take place in code defined by a call to eval?\n> * **isNative**: is this call in native V8 code?\n> * **isConstructor**: is this a constructor call?\n\n[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi\n\n## License\n\nstack-trace is licensed under the MIT license.\n",
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/felixge/node-stack-trace/issues"
},
"_id": "stack-trace@0.0.9",
"dist": {
"shasum": "a8f6eaeca90674c333e7c43953f275b451510695",
"tarball": "http://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz"
},
"_from": "stack-trace@0.0.x",
"_npmVersion": "1.3.24",
"_npmUser": {
"name": "sebastianhoitz",
"email": "hoitz@komola.de"
},
"maintainers": [
{
"name": "felixge",
"email": "felix@debuggable.com"
},
{
"name": "tim-smart",
"email": "tim@fostle.com"
},
{
"name": "sebastianhoitz",
"email": "hoitz@komola.de"
}
],
"directories": {},
"_shasum": "a8f6eaeca90674c333e7c43953f275b451510695",
"_resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
"_from": "stack-trace@>=0.0.0 <0.1.0"
"readme": "ERROR: No README data found!"
}

File diff suppressed because one or more lines are too long

View File

@@ -7,22 +7,22 @@
},
"version": "0.3.6",
"maintainers": [
{
"name": "AvianFlu",
"email": "avianflu@nodejitsu.com"
},
{
"name": "indexzero",
"email": "charlie@nodejitsu.com"
"email": "charlie.robbins@gmail.com"
},
{
"name": "Marak",
"email": "marak@nodejitsu.com"
"name": "mmalecki",
"email": "me@mmalecki.com"
},
{
"name": "jcrugzz",
"email": "jcrugzz@gmail.com"
}
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/flatiron/broadway.git"
"url": "http://github.com/flatiron/broadway.git"
},
"dependencies": {
"cliff": "0.1.9",
@@ -43,14 +43,23 @@
"engines": {
"node": ">= 0.6.4"
},
"readme": "# broadway [![Build Status](https://secure.travis-ci.org/flatiron/broadway.png)](http://travis-ci.org/flatiron/broadway)\n\n*Lightweight application extensibility and composition with a twist of feature\nreflection.*\n\n## Example\n\n### app.js\n```js\nvar broadway = require(\"broadway\");\n\nvar app = new broadway.App();\n\n// Passes the second argument to `helloworld.attach`.\napp.use(require(\"./plugins/helloworld\"), { \"delimiter\": \"!\" } );\n\napp.init(function (err) {\n if (err) {\n console.log(err);\n }\n});\n\napp.hello(\"world\");\n```\n\n### plugins/helloworld.js\n\n```js\n// `exports.attach` gets called by broadway on `app.use`\nexports.attach = function (options) {\n\n this.hello = function (world) {\n console.log(\"Hello \"+ world + options.delimiter || \".\");\n };\n\n};\n\n// `exports.init` gets called by broadway on `app.init`.\nexports.init = function (done) {\n\n // This plugin doesn't require any initialization step.\n return done();\n\n};\n```\n\n### run it!\n\n```bash\njosh@onix:~/dev/broadway/examples$ node simple/app.js \nHello world!\njosh@onix:~/dev/broadway/examples$ \n```\n\n## Installation\n\n### Installing npm (node package manager)\n``` bash\n $ curl http://npmjs.org/install.sh | sh\n```\n\n### Installing broadway\n``` bash \n $ [sudo] npm install broadway\n```\n\n## API\n\n### App#init(callback)\n\nInitialize application and it's plugins, `callback` will be called with null or\ninitialization error as first argument.\n\n### App#use(plugin, options)\n\nAttach plugin to application. `plugin` should conform to following interface:\n\n```javascript\nvar plugin = {\n \"name\": \"example-plugin\", // Plugin's name\n\n \"attach\": function attach(options) {\n // Called with plugin options once plugin attached to application\n // `this` - is a reference to application\n },\n\n \"detach\": function detach() {\n // Called when plugin detached from application\n // (Only if plugin with same name was attached)\n // `this` - is a reference to application\n },\n\n \"init\": function init(callback) {\n // Called on application initialization\n // App#init(callback) will be called once every plugin will call `callback`\n // `this` - is a reference to application\n }\n};\n```\n\n### App#on(event, callback) and App#emit(event, data)\n\nApp inherits from [EventEmitter2][2], and many plugins build on this\nfunctionality.\n\n#### Built-In Events:\n\n* `error:init`: Broadway emits this event when it throws an error while attempting to initialize.\n\nRead the [EventEmitter2][2] documentation for more information.\n\n## Tests\nAll tests are written with [vows][0] and should be run with [npm][1]:\n\n``` bash\n $ npm test\n```\n\n#### [Charlie Robbins](http://nodejitsu.com)\n#### License: MIT\n\n[0]: http://vowsjs.org\n[1]: http://npmjs.org\n[2]: https://github.com/hij1nx/EventEmitter2\n",
"readmeFilename": "README.md",
"gitHead": "d293e467b2364b2432259f8c21df0c6bf1206762",
"bugs": {
"url": "https://github.com/flatiron/broadway/issues"
},
"homepage": "https://github.com/flatiron/broadway#readme",
"homepage": "https://github.com/flatiron/broadway",
"_id": "broadway@0.3.6",
"_shasum": "7dbef068b954b7907925fd544963b578a902ba7a",
"_resolved": "https://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz",
"_from": "broadway@>=0.3.2 <0.4.0"
"_from": "broadway@~0.3.6",
"_npmVersion": "1.4.23",
"_npmUser": {
"name": "jcrugzz",
"email": "jcrugzz@gmail.com"
},
"dist": {
"shasum": "7dbef068b954b7907925fd544963b578a902ba7a",
"tarball": "http://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz"
}

View File

@@ -1,3 +1,24 @@
# Chokidar 1.4.2 (Dec 30, 2015)
* Now correctly emitting `stats` with `awaitWriteFinish` option.
# Chokidar 1.4.1 (Dec 9, 2015)
* The watcher could now be correctly subclassed with ES6 class syntax.
# Chokidar 1.4.0 (3 December 2015)
* Add `.getWatched()` method, exposing all file system entries being watched
* Apply `awaitWriteFinish` methodology to `change` events (in addition to `add`)
* Fix handling of symlinks within glob paths (#293)
* Fix `addDir` and `unlinkDir` events under globs (#337, #401)
* Fix issues with `.unwatch()` (#374, #403)
# Chokidar 1.3.0 (18 November 2015)
* Improve `awaitWriteFinish` option behavior
* Fix some `cwd` option behavior on Windows
* `awaitWriteFinish` and `cwd` are now compatible
* Fix some race conditions.
* #379: Recreating deleted directory doesn't trigger event
* When adding a previously-deleted file, emit 'add', not 'change'
# Chokidar 1.2.0 (1 October 2015)
* Allow nested arrays of paths to be provided to `.watch()` and `.add()`
* Add `awaitWriteFinish` option

View File

@@ -1,6 +1,6 @@
# Chokidar [![Mac/Linux Build Status](https://img.shields.io/travis/paulmillr/chokidar/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/paulmillr/chokidar) [![Windows Build status](https://img.shields.io/appveyor/ci/es128/chokidar/master.svg?label=Windows)](https://ci.appveyor.com/project/es128/chokidar/branch/master) [![Coverage Status](https://coveralls.io/repos/paulmillr/chokidar/badge.svg)](https://coveralls.io/r/paulmillr/chokidar) [![Join the chat at https://gitter.im/paulmillr/chokidar](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/paulmillr/chokidar?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.
> A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.
[![NPM](https://nodei.co/npm-dl/chokidar.png)](https://nodei.co/npm/chokidar/)
[![NPM](https://nodei.co/npm/chokidar.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/chokidar/)
@@ -25,15 +25,14 @@ Node.js `fs.watchFile`:
Chokidar resolves these problems.
It is used in
[brunch](http://brunch.io),
Initially made for [brunch](http://brunch.io) (an ultra-swift web app build tool), it is now used in
[gulp](https://github.com/gulpjs/gulp/),
[karma](http://karma-runner.github.io),
[PM2](https://github.com/Unitech/PM2),
[browserify](http://browserify.org/),
[webpack](http://webpack.github.io/),
[BrowserSync](http://www.browsersync.io/),
[socketstream](http://www.socketstream.org),
[derby](http://derbyjs.com/),
[Microsoft's Visual Studio Code](https://github.com/microsoft/vscode),
and [many others](https://www.npmjs.org/browse/depended/chokidar/).
It has proven itself in production environments.
@@ -64,48 +63,55 @@ Then `require` and use it in your code:
var chokidar = require('chokidar');
// One-liner for current directory, ignores .dotfiles
chokidar.watch('.', {ignored: /[\/\\]\./}).on('all', function(event, path) {
chokidar.watch('.', {ignored: /[\/\\]\./}).on('all', (event, path) => {
console.log(event, path);
});
```
```javascript
// Example of a more typical implementation structure:
// Initialize watcher
var watcher = chokidar.watch('file, dir, or glob', {
// Initialize watcher.
var watcher = chokidar.watch('file, dir, glob, or array', {
ignored: /[\/\\]\./,
persistent: true
});
// something to use when events are received
// Something to use when events are received.
var log = console.log.bind(console);
// Add event listeners
// Add event listeners.
watcher
.on('add', function(path) { log('File', path, 'has been added'); })
.on('change', function(path) { log('File', path, 'has been changed'); })
.on('unlink', function(path) { log('File', path, 'has been removed'); })
// More events.
.on('addDir', function(path) { log('Directory', path, 'has been added'); })
.on('unlinkDir', function(path) { log('Directory', path, 'has been removed'); })
.on('error', function(error) { log('Error happened', error); })
.on('ready', function() { log('Initial scan complete. Ready for changes.'); })
.on('raw', function(event, path, details) { log('Raw event info:', event, path, details); })
.on('add', path => log(`File ${path} has been added`))
.on('change', path => log(`File ${path} has been changed`))
.on('unlink', path => log(`File ${path} has been removed`));
// More possible events.
watcher
.on('addDir', path => log(`Directory ${path} has been added`))
.on('unlinkDir', path => log(`Directory ${path} has been removed`))
.on('error', error => log(`Watcher error: ${error}`))
.on('ready', () => log('Initial scan complete. Ready for changes'))
.on('raw', (event, path, details) => {
log('Raw event info:', event, path, details);
});
// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', function(path, stats) {
if (stats) console.log('File', path, 'changed size to', stats.size);
watcher.on('change', (path, stats) => {
if (stats) console.log(`File ${path} changed size to ${stats.size}`);
});
// Watch new files.
watcher.add('new-file');
watcher.add(['new-file-2', 'new-file-3', '**/other-file*']);
// Get list of actual paths being watched on the filesystem
var watchedPaths = watcher.getWatched();
// Un-watch some files.
watcher.unwatch('new-file*');
// Only needed if watching is `persistent: true`.
// Stop watching.
watcher.close();
// Full list of options. See below for descriptions. (do not use this example)
@@ -135,8 +141,11 @@ chokidar.watch('file', {
## API
`chokidar.watch(paths, options)` — takes one or more paths (which may be paths
to files, dirs to be watched recursively, or glob patterns) and options:
`chokidar.watch(paths, [options])`
* `paths` (string or array of strings). Paths to files, dirs to be watched
recursively, or glob patterns.
* `options` (object) Options object as defined below:
#### Persistence
@@ -154,8 +163,8 @@ gets called twice per path - once with a single argument (the path), second
time with two arguments (the path and the
[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats)
object of that path).
* `ignoreInitial` (default: `false`). Indicates whether chokidar
should ignore the initial `add` events or not.
* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while
instantiating the watching as chokidar discovers these file paths (before the `ready` event).
* `followSymlinks` (default: `true`). When `false`, only the
symlinks themselves will be watched for changes instead of following
the link references and bubbling events through the link's path.
@@ -190,14 +199,14 @@ subdirectories will be traversed.
* `awaitWriteFinish` (default: `false`).
By default, the `add` event will fire when a file first appear on disk, before
the entire file has been written. Furthermore, in some cases some `change`
events will be emitted while the file is being written.
In some cases, especially when watching for large files there will be a need to
wait for the write operation to finish before responding to the file creation.
Setting `awaitWriteFinish` to `true` (or a truthy value) will poll a newly
created file size, holding its `add` and `change` events until the size does not
change for a configurable amount of time. The appropriate duration setting is
heavily dependent on the OS and hardware. For accurate detection this parameter
should be relatively high, making file watching much less responsive.
events will be emitted while the file is being written. In some cases,
especially when watching for large files there will be a need to wait for the
write operation to finish before responding to a file creation or modification.
Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size,
holding its `add` and `change` events until the size does not change for a
configurable amount of time. The appropriate duration setting is heavily
dependent on the OS and hardware. For accurate detection this parameter should
be relatively high, making file watching much less responsive.
Use with caution.
* *`options.awaitWriteFinish` can be set to an object in order to adjust
timing params:*
@@ -227,6 +236,10 @@ name and path for every event other than `ready`, `raw`, and `error`.
* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns.
Takes an array of strings or just one string.
* `.close()`: Removes all listeners from watched files.
* `.getWatched()`: Returns an object representing all the paths on the file
system being watched by this `FSWatcher` instance. The object's keys are all the
directories (using absolute paths unless the `cwd` option was used), and the
values are arrays of the names of the items contained in each directory.
## CLI
@@ -251,7 +264,7 @@ execute a command on each change, or get a stdio stream of change events.
## License
The MIT license.
Copyright (c) 2012 - 2015 Paul Miller (http://paulmillr.com) & Elan Shanker
Copyright (c) 2012 - 2015 Paul Miller [paulmillr.com](http://paulmillr.com) & Elan Shanker
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -2,17 +2,38 @@
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var sysPath = require('path');
var each = require('async-each');
var asyncEach = require('async-each');
var anymatch = require('anymatch');
var globparent = require('glob-parent');
var isglob = require('is-glob');
var arrify = require('arrify');
var globParent = require('glob-parent');
var isGlob = require('is-glob');
var isAbsolute = require('path-is-absolute');
var flatten = require('lodash.flatten');
var inherits = require('inherits');
var NodeFsHandler = require('./lib/nodefs-handler');
var FsEventsHandler = require('./lib/fsevents-handler');
var arrify = function(value) {
if (value == null) return [];
return Array.isArray(value) ? value : [value];
};
var flatten = function(list, result) {
if (result == null) result = [];
list.forEach(function(item) {
if (Array.isArray(item)) {
flatten(item, result);
} else {
result.push(item);
}
});
return result;
};
// Little isString util for use in Array#every.
var isString = function(thing) {
return typeof thing === 'string';
};
// Public: Main class.
// Watches files & directories for changes.
//
@@ -31,6 +52,7 @@ var FsEventsHandler = require('./lib/fsevents-handler');
// .on('all', function(event, path) {console.log(path, ' emitted ', event);})
//
function FSWatcher(_opts) {
EventEmitter.call(this);
var opts = {};
// in case _opts that is passed in is a frozen object
if (_opts) for (var opt in _opts) opts[opt] = _opts[opt];
@@ -83,6 +105,7 @@ function FSWatcher(_opts) {
this._pendingWrites = Object.create(null);
}
if (opts.ignored) opts.ignored = arrify(opts.ignored);
this._isntIgnored = function(path, stat) {
return !this._isIgnored(path, stat);
@@ -92,6 +115,7 @@ function FSWatcher(_opts) {
this._emitReady = function() {
if (++readyCalls >= this._readyCount) {
this._emitReady = Function.prototype;
this._readyEmitted = true;
// use process.nextTick to allow time for listener to be bound
process.nextTick(this.emit.bind(this, 'ready'));
}
@@ -103,7 +127,7 @@ function FSWatcher(_opts) {
Object.freeze(opts);
}
FSWatcher.prototype = Object.create(EventEmitter.prototype);
inherits(FSWatcher, EventEmitter);
// Common helpers
// --------------
@@ -143,28 +167,37 @@ FSWatcher.prototype._emit = function(event, path, val1, val2, val3) {
}
}
if (event === 'change') {
if (!this._throttle('change', path, 50)) return this;
}
var emitEvent = function() {
this.emit.apply(this, args);
if (event !== 'error') this.emit.apply(this, ['all'].concat(args));
}.bind(this);
if (awf && event === 'add') {
this._awaitWriteFinish(path, awf.stabilityThreshold, function(err, stats) {
if (awf && (event === 'add' || event === 'change') && this._readyEmitted) {
var awfEmit = function(err, stats) {
if (err) {
event = args[0] = 'error';
args[1] = err;
emitEvent();
} else if (stats) {
// if stats doesn't exist the file must have been deleted
args.push(stats);
if (args.length > 2) {
args[2] = stats;
} else {
args.push(stats);
}
emitEvent();
}
});
} else if (
};
this._awaitWriteFinish(path, awf.stabilityThreshold, awfEmit);
return this;
}
if (event === 'change') {
if (!this._throttle('change', path, 50)) return this;
}
if (
this.options.alwaysStat && val1 === undefined &&
(event === 'add' || event === 'addDir' || event === 'change')
) {
@@ -226,52 +259,58 @@ FSWatcher.prototype._throttle = function(action, path, timeout) {
// * path - string, path being acted upon
// * threshold - int, time in milliseconds a file size must be fixed before
// acknowledgeing write operation is finished
// * callback - function, callback to call when write operation is finished
// * awfEmit - function, to be called when ready for event to be emitted
// Polls a newly created file for size variations. When files size does not
// change for 'threshold' milliseconds calls callback.
FSWatcher.prototype._awaitWriteFinish = function(path, threshold, callback) {
FSWatcher.prototype._awaitWriteFinish = function(path, threshold, awfEmit) {
var timeoutHandler;
(function awaitWriteFinish (prevStat) {
fs.stat(path, function(err, curStat) {
var fullPath = path;
if (this.options.cwd && !isAbsolute(path)) {
fullPath = sysPath.join(this.options.cwd, path);
}
var now = new Date();
var awaitWriteFinish = (function (prevStat) {
fs.stat(fullPath, function(err, curStat) {
if (err) {
// if the file have been erased, the file entry in _pendingWrites will
// be deleted in the unlink event.
if (err.code == 'ENOENT') return;
return callback(err);
if (err.code !== 'ENOENT') awfEmit(err);
return;
}
var now = new Date();
if (this._pendingWrites[path] === undefined) {
this._pendingWrites[path] = {
creationTime: now,
cancelWait: function() {
delete this._pendingWrites[path];
clearTimeout(timeoutHandler);
return callback();
}.bind(this)
}
return timeoutHandler = setTimeout(
awaitWriteFinish.bind(this, curStat),
this.options.awaitWriteFinish.pollInterval
);
if (prevStat && curStat.size != prevStat.size) {
this._pendingWrites[path].lastChange = now;
}
if (
curStat.size == prevStat.size &&
now - this._pendingWrites[path].creationTime > threshold
) {
if (now - this._pendingWrites[path].lastChange >= threshold) {
delete this._pendingWrites[path];
callback(null, curStat);
awfEmit(null, curStat);
} else {
return timeoutHandler = setTimeout(
timeoutHandler = setTimeout(
awaitWriteFinish.bind(this, curStat),
this.options.awaitWriteFinish.pollInterval
);
}
}.bind(this));
}.bind(this))();
}
}.bind(this));
if (!(path in this._pendingWrites)) {
this._pendingWrites[path] = {
lastChange: now,
cancelWait: function() {
delete this._pendingWrites[path];
clearTimeout(timeoutHandler);
}.bind(this)
};
timeoutHandler = setTimeout(
awaitWriteFinish.bind(this),
this.options.awaitWriteFinish.pollInterval
);
}
};
// Private method: Determines whether user has asked to ignore this path
//
@@ -279,30 +318,27 @@ FSWatcher.prototype._awaitWriteFinish = function(path, threshold, callback) {
// * stats - object, result of fs.stat
//
// Returns boolean
var dotRe = /\..*\.(sw[px])$|\~$|\.subl.*\.tmp/;
FSWatcher.prototype._isIgnored = function(path, stats) {
if (
this.options.atomic &&
/\..*\.(sw[px])$|\~$|\.subl.*\.tmp/.test(path)
) return true;
if (this.options.atomic && dotRe.test(path)) return true;
if (!this._userIgnored) {
var cwd = this.options.cwd;
var ignored = this.options.ignored;
if (cwd && ignored) {
ignored = arrify(ignored).map(function (path) {
ignored = ignored.map(function (path) {
if (typeof path !== 'string') return path;
return isAbsolute(path) ? path : sysPath.join(cwd, path);
});
}
this._userIgnored = anymatch(this._globIgnored
.concat(ignored)
.concat(arrify(ignored)
.filter(function(path) {
return typeof path === 'string' && !isglob(path);
}).map(function(path) {
return path + '/**/*';
})
)
var paths = arrify(ignored)
.filter(function(path) {
return typeof path === 'string' && !isGlob(path);
}).map(function(path) {
return path + '/**';
});
this._userIgnored = anymatch(
this._globIgnored.concat(ignored).concat(paths)
);
}
@@ -316,19 +352,43 @@ FSWatcher.prototype._isIgnored = function(path, stats) {
// * depth - int, at any depth > 0, this isn't a glob
//
// Returns object containing helpers for this path
var replacerRe = /^\.[\/\\]/;
FSWatcher.prototype._getWatchHelpers = function(path, depth) {
path = path.replace(/^\.[\/\\]/, '');
var watchPath = depth || !isglob(path) ? path : globparent(path);
path = path.replace(replacerRe, '');
var watchPath = depth || !isGlob(path) ? path : globParent(path);
var fullWatchPath = sysPath.resolve(watchPath);
var hasGlob = watchPath !== path;
var globFilter = hasGlob ? anymatch(path) : false;
var follow = this.options.followSymlinks;
var globSymlink = hasGlob && follow ? null : false;
var checkGlobSymlink = function(entry) {
// only need to resolve once
// first entry should always have entry.parentDir === ''
if (globSymlink == null) {
globSymlink = entry.fullParentDir === fullWatchPath ? false : {
realPath: entry.fullParentDir,
linkPath: fullWatchPath
};
}
if (globSymlink) {
return entry.fullPath.replace(globSymlink.realPath, globSymlink.linkPath);
}
return entry.fullPath;
};
var entryPath = function(entry) {
return sysPath.join(watchPath, sysPath.relative(watchPath, entry.fullPath));
}
return sysPath.join(watchPath,
sysPath.relative(watchPath, checkGlobSymlink(entry))
);
};
var filterPath = function(entry) {
return (!hasGlob || globFilter(entryPath(entry))) &&
this._isntIgnored(entryPath(entry), entry.stat) &&
var resolvedPath = entryPath(entry);
return (!hasGlob || globFilter(resolvedPath)) &&
this._isntIgnored(resolvedPath, entry.stat) &&
(this.options.ignorePermissionErrors ||
this._hasReadPermissions(entry.stat));
}.bind(this);
@@ -337,15 +397,17 @@ FSWatcher.prototype._getWatchHelpers = function(path, depth) {
if (!hasGlob) return false;
var parts = sysPath.relative(watchPath, path).split(/[\/\\]/);
return parts;
}
};
var dirParts = getDirParts(path);
if (dirParts && dirParts.length > 1) dirParts.pop();
var unmatchedGlob;
var filterDir = function(entry) {
if (hasGlob) {
var entryParts = getDirParts(entry.fullPath);
var entryParts = getDirParts(checkGlobSymlink(entry));
var globstar = false;
var unmatchedGlob = !dirParts.every(function(part, i) {
unmatchedGlob = !dirParts.every(function(part, i) {
if (part === '**') globstar = true;
return globstar || !entryParts[i] || anymatch(part, entryParts[i]);
});
@@ -354,8 +416,8 @@ FSWatcher.prototype._getWatchHelpers = function(path, depth) {
}.bind(this);
return {
followSymlinks: this.options.followSymlinks,
statMethod: this.options.followSymlinks ? 'stat' : 'lstat',
followSymlinks: follow,
statMethod: follow ? 'stat' : 'lstat',
path: path,
watchPath: watchPath,
entryPath: entryPath,
@@ -364,7 +426,7 @@ FSWatcher.prototype._getWatchHelpers = function(path, depth) {
filterPath: filterPath,
filterDir: filterDir
};
}
};
// Directory helpers
// -----------------
@@ -379,7 +441,9 @@ FSWatcher.prototype._getWatchedDir = function(directory) {
var watcherRemove = this._remove.bind(this);
if (!(dir in this._watched)) this._watched[dir] = {
_items: Object.create(null),
add: function(item) {this._items[item] = true;},
add: function(item) {
if (item !== '.') this._items[item] = true;
},
remove: function(item) {
delete this._items[item];
if (!this.children().length) {
@@ -459,8 +523,20 @@ FSWatcher.prototype._remove = function(directory, item) {
delete this._watched[fullPath];
var eventName = isDirectory ? 'unlinkDir' : 'unlink';
if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path);
// Avoid conflicts if we later create another file with the same name
if (!this.options.useFsEvents) {
this._closePath(path);
}
};
FSWatcher.prototype._closePath = function(path) {
if (!this._closers[path]) return;
this._closers[path]();
delete this._closers[path];
this._getWatchedDir(sysPath.dirname(path)).remove(sysPath.basename(path));
}
// Public method: Adds paths to be watched on an existing FSWatcher instance
// * paths - string or array of strings, file/directory paths and/or globs
@@ -474,7 +550,7 @@ FSWatcher.prototype.add = function(paths, _origAdd, _internal) {
paths = flatten(arrify(paths));
if (!paths.every(isString)) {
throw new TypeError('Non-string provided as watch path');
throw new TypeError('Non-string provided as watch path: ' + paths);
}
if (cwd) paths = paths.map(function(path) {
@@ -489,11 +565,12 @@ FSWatcher.prototype.add = function(paths, _origAdd, _internal) {
// set aside negated glob strings
paths = paths.filter(function(path) {
if (path[0] === '!') this._ignoredPaths[path.substring(1)] = true;
else {
if (path[0] === '!') {
this._ignoredPaths[path.substring(1)] = true;
} else {
// if a path is being added that was previously ignored, stop ignoring it
delete this._ignoredPaths[path];
delete this._ignoredPaths[path + '/**/*'];
delete this._ignoredPaths[path + '/**'];
// reset the cached userIgnored anymatch fn
// to make ignoredPaths changes effective
@@ -510,7 +587,7 @@ FSWatcher.prototype.add = function(paths, _origAdd, _internal) {
} else {
if (!this._readyCount) this._readyCount = 0;
this._readyCount += paths.length;
each(paths, function(path, next) {
asyncEach(paths, function(path, next) {
this._addToNodeFs(path, !_internal, 0, 0, _origAdd, function(err, res) {
if (res) this._emitReady();
next(err, res);
@@ -536,23 +613,22 @@ FSWatcher.prototype.unwatch = function(paths) {
paths = flatten(arrify(paths));
paths.forEach(function(path) {
if (this._closers[path]) {
this._closers[path]();
delete this._closers[path];
this._getWatchedDir(sysPath.dirname(path)).remove(sysPath.basename(path));
} else {
//convert to absolute path
// convert to absolute path unless relative path already matches
if (!isAbsolute(path) && !this._closers[path]) {
if (this.options.cwd) path = sysPath.join(this.options.cwd, path);
path = sysPath.resolve(path);
this._ignoredPaths[path] = true;
if (path in this._watched) {
this._ignoredPaths[path + '/**/*'] = true;
}
// reset the cached userIgnored anymatch fn
// to make ignoredPaths changes effective
this._userIgnored = null;
}
this._closePath(path);
this._ignoredPaths[path] = true;
if (path in this._watched) {
this._ignoredPaths[path + '/**'] = true;
}
// reset the cached userIgnored anymatch fn
// to make ignoredPaths changes effective
this._userIgnored = null;
}, this);
return this;
@@ -575,6 +651,18 @@ FSWatcher.prototype.close = function() {
return this;
};
// Public method: Expose list of watched paths
// Returns object w/ dir paths as keys and arrays of contained paths as values.
FSWatcher.prototype.getWatched = function() {
var watchList = {};
Object.keys(this._watched).forEach(function(dir) {
var key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
watchList[key || '.'] = Object.keys(this._watched[dir]._items).sort();
}.bind(this));
return watchList;
};
// Attach watch handler prototype methods
function importHandler(handler) {
Object.keys(handler.prototype).forEach(function(method) {
@@ -584,11 +672,6 @@ function importHandler(handler) {
importHandler(NodeFsHandler);
if (FsEventsHandler.canUse()) importHandler(FsEventsHandler);
// little isString util for use in Array.prototype.every
function isString(maybeString) {
return typeof maybeString === 'string'
}
// Export FSWatcher class
exports.FSWatcher = FSWatcher;

View File

@@ -86,7 +86,7 @@ function setFSEventsListener(path, realPath, listener, rawEmitter) {
watchContainer.watcher.stop();
delete FSEventsWatchers[watchPath];
}
}
};
}
// returns boolean indicating whether fsevents can be used

View File

@@ -193,7 +193,7 @@ function setFsWatchFileListener(path, fullPath, options, handlers) {
fs.unwatchFile(fullPath);
delete FsWatchFileInstances[fullPath];
}
}
};
}
// fake constructor for attaching nodefs-specific prototype methods that
@@ -314,7 +314,7 @@ function(entry, directory, path, item) {
// don't follow the same symlink more than once
if (this._symlinkPaths[full]) return true;
else this._symlinkPaths[full] = true;
}
};
// Private method: Read directory to add / remove files from `@watched` list
// and re-read it on change.
@@ -330,12 +330,14 @@ function(entry, directory, path, item) {
// Returns close function for the watcher instance
NodeFsHandler.prototype._handleDir =
function(dir, stats, initialAdd, depth, target, wh, callback) {
if (!(initialAdd && this.options.ignoreInitial) && !target && !wh.hasGlob) {
this._emit('addDir', dir, stats);
var parentDir = this._getWatchedDir(sysPath.dirname(dir));
var tracked = parentDir.has(sysPath.basename(dir));
if (!(initialAdd && this.options.ignoreInitial) && !target && !tracked) {
if (!wh.hasGlob || wh.globFilter(dir)) this._emit('addDir', dir, stats);
}
// ensure dir is tracked
this._getWatchedDir(sysPath.dirname(dir)).add(sysPath.basename(dir));
// ensure dir is tracked (harmless if redundant)
parentDir.add(sysPath.basename(dir));
this._getWatchedDir(dir);
var read = function(directory, initialAdd, done) {
@@ -398,9 +400,11 @@ function(dir, stats, initialAdd, depth, target, wh, callback) {
}.bind(this)).on('error', this._handleError.bind(this));
}.bind(this);
var closer;
if (this.options.depth == null || depth <= this.options.depth) {
if (!target) read(dir, initialAdd, callback);
var closer = this._watchWithNodeFs(dir, function(dirPath, stats) {
closer = this._watchWithNodeFs(dir, function(dirPath, stats) {
// if current directory is removed, do nothing
if (stats && stats.mtime.getTime() === 0) return;
@@ -434,6 +438,7 @@ function(path, initialAdd, priorWh, depth, target, callback) {
var wh = this._getWatchHelpers(path, depth);
if (!wh.hasGlob && priorWh) {
wh.hasGlob = priorWh.hasGlob;
wh.globFilter = priorWh.globFilter;
wh.filterPath = priorWh.filterPath;
wh.filterDir = priorWh.filterDir;
}

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (val) {
if (val == null) {
if (val === null || val === undefined) {
return [];
}

View File

@@ -1,11 +1,11 @@
{
"name": "arrify",
"version": "1.0.0",
"version": "1.0.1",
"description": "Convert a value to an array",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/arrify"
"url": "git+https://github.com/sindresorhus/arrify.git"
},
"author": {
"name": "Sindre Sorhus",
@@ -16,7 +16,7 @@
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
"test": "xo && ava"
},
"files": [
"index.js"
@@ -30,32 +30,33 @@
"value"
],
"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
},
"gitHead": "4576e944677c722c356480b17a6d709d34d0733c",
"gitHead": "087edee1a58d5adaac6cae5a107886121ef43783",
"bugs": {
"url": "https://github.com/sindresorhus/arrify/issues"
},
"homepage": "https://github.com/sindresorhus/arrify",
"_id": "arrify@1.0.0",
"_shasum": "d6c361518250802fa2147ea7fb67597128cb8c81",
"_from": "arrify@>=1.0.0 <2.0.0",
"_npmVersion": "2.5.0",
"_nodeVersion": "0.12.0",
"homepage": "https://github.com/sindresorhus/arrify#readme",
"_id": "arrify@1.0.1",
"_shasum": "898508da2226f380df904728456849c1501a4b0d",
"_from": "arrify@^1.0.0",
"_npmVersion": "3.5.2",
"_nodeVersion": "4.2.1",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "898508da2226f380df904728456849c1501a4b0d",
"tarball": "http://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"dist": {
"shasum": "d6c361518250802fa2147ea7fb67597128cb8c81",
"tarball": "http://registry.npmjs.org/arrify/-/arrify-1.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.0.tgz"
"_resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz"
}

View File

@@ -13,7 +13,7 @@ $ npm install --save arrify
## Usage
```js
var arrify = require('arrify');
const arrify = require('arrify');
arrify('unicorn');
//=> ['unicorn']
@@ -24,7 +24,7 @@ arrify(['unicorn']);
arrify(null);
//=> []
arrift(undefined);
arrify(undefined);
//=> []
```

View File

@@ -52,15 +52,15 @@ $ npm i micromatch --save
* [Author](#author)
* [License](#license)
_(Table of contents generated by [verb](https://github.com/assemble/verb))_
_(Table of contents generated by [verb](https://github.com/verbose/verb))_
<!-- tocstop -->
## Features
Micromatch is [10-55x faster](#benchmarks) than [minimatch](https://github.com/isaacs/minimatch#readme), resulting from a combination of caching, tokenization, parsing, runtime compilation and regex optimization strategies.
Micromatch is [10-55x faster](#benchmarks) than [minimatch](https://github.com/isaacs/minimatch), resulting from a combination of caching, tokenization, parsing, runtime compilation and regex optimization strategies.
* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch#readme) and [multimatch](https://github.com/sindresorhus/multimatch)
* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']`
* Better support for the Bash 4.3 specification, and less buggy
* Extensive [unit tests](./test) (approx. 1,300 tests). Minimatch fails many of the tests.
@@ -106,7 +106,7 @@ mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']);
Behavior;
* when the pattern is a string, [minimatch](https://github.com/isaacs/minimatch#readme) behavior is used, so patterns are **inclusive by default**.
* when the pattern is a string, [minimatch](https://github.com/isaacs/minimatch) behavior is used, so patterns are **inclusive by default**.
* when an array of patterns is passed, [multimatch](https://github.com/sindresorhus/multimatch) behavior is used, so patterns are **exclusive by default**
```js
@@ -322,7 +322,7 @@ Default: `undefined` on non-windows, `true` on windows.
### options.dot
Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
@@ -365,7 +365,7 @@ mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true, nodupes: true});
### options.matchBase
Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
@@ -383,7 +383,7 @@ mm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true});
### options.nobraces
Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme) `nobrace`.
Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) `nobrace`.
Type: `{Boolean}`
@@ -413,7 +413,7 @@ See [extglob](https://github.com/jonschlinkert/extglob) for more information abo
### options.nocase
Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
@@ -421,7 +421,7 @@ Default: `false`
### options.nonull
If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
@@ -516,60 +516,60 @@ Run the [benchmarks](./benchmark):
node benchmark
```
As of July 24, 2015:
As of October 03, 2015:
```bash
#1: basename-braces
micromatch x 28,335 ops/sec ±0.49% (96 runs sampled)
minimatch x 3,496 ops/sec ±0.76% (98 runs sampled)
micromatch x 26,420 ops/sec ±0.89% (91 runs sampled)
minimatch x 3,507 ops/sec ±0.64% (97 runs sampled)
#2: basename
micromatch x 28,602 ops/sec ±0.46% (96 runs sampled)
minimatch x 4,389 ops/sec ±0.38% (98 runs sampled)
micromatch x 25,315 ops/sec ±0.82% (93 runs sampled)
minimatch x 4,398 ops/sec ±0.86% (94 runs sampled)
#3: braces-no-glob
micromatch x 405,445 ops/sec ±0.64% (91 runs sampled)
minimatch x 31,078 ops/sec ±0.45% (95 runs sampled)
micromatch x 341,254 ops/sec ±0.78% (93 runs sampled)
minimatch x 30,197 ops/sec ±1.12% (91 runs sampled)
#4: braces
micromatch x 81,977 ops/sec ±0.36% (99 runs sampled)
minimatch x 2,986 ops/sec ±0.41% (100 runs sampled)
micromatch x 54,649 ops/sec ±0.74% (94 runs sampled)
minimatch x 3,095 ops/sec ±0.82% (95 runs sampled)
#5: immediate
micromatch x 20,753 ops/sec ±0.36% (101 runs sampled)
minimatch x 4,233 ops/sec ±0.34% (100 runs sampled)
micromatch x 16,719 ops/sec ±0.79% (95 runs sampled)
minimatch x 4,348 ops/sec ±0.86% (96 runs sampled)
#6: large
micromatch x 755 ops/sec ±0.53% (97 runs sampled)
minimatch x 17.06 ops/sec ±0.25% (46 runs sampled)
micromatch x 721 ops/sec ±0.77% (94 runs sampled)
minimatch x 17.73 ops/sec ±1.08% (50 runs sampled)
#7: long
micromatch x 7,009 ops/sec ±0.33% (100 runs sampled)
minimatch x 592 ops/sec ±0.39% (96 runs sampled)
micromatch x 5,051 ops/sec ±0.87% (97 runs sampled)
minimatch x 628 ops/sec ±0.83% (94 runs sampled)
#8: mid
micromatch x 60,071 ops/sec ±0.48% (97 runs sampled)
minimatch x 1,853 ops/sec ±0.72% (99 runs sampled)
micromatch x 51,280 ops/sec ±0.80% (95 runs sampled)
minimatch x 1,923 ops/sec ±0.84% (95 runs sampled)
#9: multi-patterns
micromatch x 24,308 ops/sec ±0.67% (98 runs sampled)
minimatch x 2,169 ops/sec ±0.62% (96 runs sampled)
micromatch x 22,440 ops/sec ±0.97% (94 runs sampled)
minimatch x 2,481 ops/sec ±1.10% (94 runs sampled)
#10: no-glob
micromatch x 552,116 ops/sec ±0.35% (96 runs sampled)
minimatch x 55,957 ops/sec ±0.32% (94 runs sampled)
micromatch x 722,823 ops/sec ±1.30% (87 runs sampled)
minimatch x 52,967 ops/sec ±1.09% (94 runs sampled)
#11: range
micromatch x 321,030 ops/sec ±0.62% (95 runs sampled)
minimatch x 14,247 ops/sec ±0.59% (100 runs sampled)
micromatch x 243,471 ops/sec ±0.79% (94 runs sampled)
minimatch x 11,736 ops/sec ±0.82% (96 runs sampled)
#12: shallow
micromatch x 253,455 ops/sec ±0.52% (99 runs sampled)
minimatch x 21,169 ops/sec ±0.54% (97 runs sampled)
micromatch x 190,874 ops/sec ±0.98% (95 runs sampled)
minimatch x 21,699 ops/sec ±0.81% (97 runs sampled)
#13: short
micromatch x 661,874 ops/sec ±0.42% (96 runs sampled)
minimatch x 60,228 ops/sec ±0.45% (97 runs sampled)
micromatch x 496,393 ops/sec ±3.86% (90 runs sampled)
minimatch x 53,765 ops/sec ±0.75% (95 runs sampled)
```
## Run tests
@@ -582,20 +582,20 @@ $ npm i -d && npm test
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/micromatch/issues/new)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/micromatch/issues/new).
Please be sure to run the benchmarks before/after any code changes to judge the impact before you do a PR. thanks!
## Related
* [braces](https://github.com/jonschlinkert/braces): Fastest brace expansion for node.js, with the most complete… [more](https://github.com/jonschlinkert/braces)
* [extglob](https://github.com/jonschlinkert/extglob): Convert extended globs to regex-compatible strings. Add (almost) the… [more](https://github.com/jonschlinkert/extglob)
* [expand-brackets](https://github.com/jonschlinkert/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns.
* [expand-range](https://github.com/jonschlinkert/expand-range): Fast, bash-like range expansion. Expand a range of numbers… [more](https://github.com/jonschlinkert/expand-range)
* [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally… [more](https://github.com/jonschlinkert/fill-range)
* [gulp-micromatch](https://github.com/tunnckoCore/gulp-micromatch#readme): micromatch as gulp plugin. Filtering vinyl files with glob… [more](https://github.com/tunnckoCore/gulp-micromatch#readme)
* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a… [more](https://github.com/jonschlinkert/is-glob)
* [parse-glob](https://github.com/jonschlinkert/parse-glob): Parse a glob pattern into an object of tokens.
* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete… [more](https://www.npmjs.com/package/braces) | [homepage](https://github.com/jonschlinkert/braces)
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets)
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers… [more](https://www.npmjs.com/package/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range)
* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the… [more](https://www.npmjs.com/package/extglob) | [homepage](https://github.com/jonschlinkert/extglob)
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally… [more](https://www.npmjs.com/package/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range)
* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array,… [more](https://www.npmjs.com/package/gulp-micromatch) | [homepage](https://github.com/tunnckocore/gulp-micromatch)
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob)
## Author
@@ -611,6 +611,6 @@ Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 24, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 03, 2015._
<!-- deps:mocha browserify -->
<!-- deps:mocha browserify -->

View File

@@ -7,12 +7,6 @@
'use strict';
var diff = require('arr-diff');
var typeOf = require('kind-of');
var omit = require('object.omit');
var unique = require('array-unique');
var cache = require('regex-cache');
var isGlob = require('is-glob');
var expand = require('./lib/expand');
var utils = require('./lib/utils');
@@ -43,13 +37,13 @@ function micromatch(files, patterns, opts) {
while (len--) {
var glob = patterns[i++];
if (glob.charCodeAt(0) === 33 /* ! */) {
if (typeof glob === 'string' && glob.charCodeAt(0) === 33 /* ! */) {
omit.push.apply(omit, match(files, glob.slice(1), opts));
} else {
keep.push.apply(keep, match(files, glob, opts));
}
}
return diff(keep, omit);
return utils.diff(keep, omit);
}
/**
@@ -66,7 +60,7 @@ function micromatch(files, patterns, opts) {
*/
function match(files, pattern, opts) {
if (typeOf(files) !== 'string' && !Array.isArray(files)) {
if (utils.typeOf(files) !== 'string' && !Array.isArray(files)) {
throw new Error(msg('match', 'files', 'a string or array'));
}
@@ -76,11 +70,17 @@ function match(files, pattern, opts) {
var negate = opts.negate || false;
var orig = pattern;
if (typeof pattern === 'string' && opts.nonegate !== true) {
if (typeof pattern === 'string') {
negate = pattern.charAt(0) === '!';
if (negate) {
pattern = pattern.slice(1);
}
// we need to remove the character regardless,
// so the above logic is still needed
if (opts.nonegate === true) {
negate = false;
}
}
var _isMatch = matcher(pattern, opts);
@@ -106,17 +106,17 @@ function match(files, pattern, opts) {
}
// if `negate` was defined, diff negated files
if (negate) { res = diff(files, res); }
if (negate) { res = utils.diff(files, res); }
// if `ignore` was defined, diff ignored filed
if (opts.ignore && opts.ignore.length) {
pattern = opts.ignore;
opts = omit(opts, ['ignore']);
res = diff(res, micromatch(res, pattern, opts));
opts = utils.omit(opts, ['ignore']);
res = utils.diff(res, micromatch(res, pattern, opts));
}
if (opts.nodupes) {
return unique(res);
return utils.unique(res);
}
return res;
}
@@ -143,14 +143,20 @@ function filter(patterns, opts) {
}
patterns = utils.arrayify(patterns);
return function (fp) {
var len = patterns.length, i = 0;
var patternMatchers = Array(len);
while (i < len) {
patternMatchers[i] = matcher(patterns[i++], opts);
}
return function(fp) {
if (fp == null) return [];
var len = patterns.length, i = 0;
var len = patternMatchers.length, i = 0;
var res = true;
fp = utils.unixify(fp, opts);
while (i < len) {
var fn = matcher(patterns[i++], opts);
var fn = patternMatchers[i++];
if (!fn(fp)) {
res = false;
break;
@@ -184,7 +190,7 @@ function isMatch(fp, pattern, opts) {
}
fp = utils.unixify(fp, opts);
if (typeOf(pattern) === 'object') {
if (utils.typeOf(pattern) === 'object') {
return matcher(fp, pattern);
}
return matcher(pattern, opts)(fp);
@@ -204,7 +210,7 @@ function contains(fp, pattern, opts) {
opts.contains = (pattern !== '');
fp = utils.unixify(fp, opts);
if (opts.contains && !isGlob(pattern)) {
if (opts.contains && !utils.isGlob(pattern)) {
return fp.indexOf(pattern) !== -1;
}
return matcher(pattern, opts)(fp);
@@ -248,7 +254,7 @@ function any(fp, patterns, opts) {
*/
function matchKeys(obj, glob, options) {
if (typeOf(obj) !== 'object') {
if (utils.typeOf(obj) !== 'object') {
throw new TypeError(msg('matchKeys', 'first argument', 'an object'));
}
@@ -284,11 +290,15 @@ function matcher(pattern, opts) {
};
}
if (typeof pattern !== 'string') {
throw new TypeError(msg('matcher', 'pattern', 'a string, regex, or function'));
}
// strings, all the way down...
pattern = utils.unixify(pattern, opts);
// pattern is a non-glob string
if (!isGlob(pattern)) {
if (!utils.isGlob(pattern)) {
return utils.matchPath(pattern, opts);
}
// pattern is a glob string
@@ -318,10 +328,6 @@ function matcher(pattern, opts) {
*/
function toRegex(glob, options) {
if (typeOf(glob) !== 'string') {
throw new Error(msg('toRegex', 'glob', 'a string'));
}
// clone options to prevent mutating the original object
var opts = Object.create(options || {});
var flags = opts.flags || '';
@@ -341,9 +347,12 @@ function toRegex(glob, options) {
re = new RegExp(glob, flags);
return re;
} catch (err) {
var msg = 'micromatch invalid regex: (' + re + ')';
if (opts.strict) throw new SyntaxError(msg + err);
err.reason = 'micromatch invalid regex: (' + re + ')';
if (opts.strict) throw new SyntaxError(err);
}
// we're only here if a bad pattern was used and the user
// passed `options.silent`, so match nothing
return /$^/;
}
@@ -366,12 +375,15 @@ function wrapGlob(glob, opts) {
}
/**
* Wrap `toRegex` to memoize the generated regex
* Wrap `toRegex` to memoize the generated regex when
* the string and options don't change
*/
function makeRe(glob, opts) {
return cache(toRegex, glob, opts);
if (utils.typeOf(glob) !== 'string') {
throw new Error(msg('makeRe', 'glob', 'a string'));
}
return utils.cache(toRegex, glob, opts);
}
/**
@@ -397,8 +409,9 @@ function msg(method, what, type) {
* Public methods
*/
/* eslint no-multi-spaces: 0 */
micromatch.any = any;
micromatch.braces = micromatch.braceExpand = require('braces');
micromatch.braces = micromatch.braceExpand = utils.braces;
micromatch.contains = contains;
micromatch.expand = expand;
micromatch.filter = filter;

View File

@@ -1,14 +1,14 @@
'use strict';
var reverse = function(object, prepender) {
var chars = {}, unesc, temp;
function reverse(object, prepender) {
return Object.keys(object).reduce(function(reversed, key) {
var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key.
reversed[object[key]] = newKey; // Swap key and value.
return reversed; // Return the result.
}, {});
};
var chars = {};
}
/**
* Regex for common characters
@@ -23,7 +23,7 @@ chars.escapeRegex = {
'(': /\(/g,
')': /\)/g,
'[': /\[/g,
']': /\]/g,
']': /\]/g
};
/**
@@ -40,14 +40,14 @@ chars.ESC = {
'(': '__UNESC_LTPAREN__',
')': '__UNESC_RTPAREN__',
'[': '__UNESC_LTBRACK__',
']': '__UNESC_RTBRACK__',
']': '__UNESC_RTBRACK__'
};
/**
* Unescape characters
*/
chars.UNESC = reverse(chars.ESC, '\\');
chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\'));
chars.ESC_TEMP = {
'?': '__TEMP_QMRK__',
@@ -59,9 +59,9 @@ chars.ESC_TEMP = {
'(': '__TEMP_LTPAREN__',
')': '__TEMP_RTPAREN__',
'[': '__TEMP_LTBRACK__',
']': '__TEMP_RTBRACK__',
']': '__TEMP_RTBRACK__'
};
chars.TEMP = reverse(chars.ESC_TEMP);
chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP));
module.exports = chars;

View File

@@ -34,13 +34,16 @@ function expand(pattern, options) {
var glob = new Glob(pattern, options || {});
var opts = glob.options;
if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') {
opts.braces = true;
if (!utils.isGlob(pattern)) {
glob.pattern = glob.pattern.replace(/([\/.])/g, '\\$1');
return glob;
}
// return early if glob pattern matches special patterns
if (specialCase(pattern) && opts.safemode) {
return new RegExp(utils.escapeRe(pattern), 'g');
glob.pattern = glob.pattern.replace(/(\+)(?!\()/g, '\\$1');
glob.pattern = glob.pattern.split('$').join('\\$');
if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') {
opts.braces = true;
}
if (glob.pattern === '.*') {
@@ -51,14 +54,6 @@ function expand(pattern, options) {
};
}
if (glob.pattern === '.') {
return {
pattern: '\\.',
tokens: tok,
options: opts
};
}
if (glob.pattern === '*') {
return {
pattern: oneStar(opts.dot),
@@ -102,13 +97,6 @@ function expand(pattern, options) {
* Extended globs
*/
// expand brackets, e.g `[[:alpha:]]`
glob.track('before brackets');
if (tok.is.brackets) {
glob.brackets();
}
glob.track('after brackets');
// expand braces, e.g `{1..5}`
glob.track('before braces');
if (tok.is.braces) {
@@ -123,10 +111,17 @@ function expand(pattern, options) {
}
glob.track('after extglob');
// expand brackets, e.g `[[:alpha:]]`
glob.track('before brackets');
if (tok.is.brackets) {
glob.brackets();
}
glob.track('after brackets');
// special patterns
glob._replace('[!', '[^');
glob._replace('(?', '(%~');
glob._replace('[]', '\\[\\]');
glob._replace(/\[\]/, '\\[\\]');
glob._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true);
glob._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true);
glob._replace('/.', '/(?=.)\\.', true);
@@ -140,11 +135,11 @@ function expand(pattern, options) {
}
if (opts.globstar !== false && glob.pattern === '**') {
glob.pattern = globstar(opts.dot);
glob.pattern = globstar(opts.dot);
} else {
// '/*/*/*' => '(?:/*){3}'
glob._replace(/(\/\*)+/g, function (match) {
glob._replace(/(\/\*)+/g, function(match) {
var len = match.length / 2;
if (len === 1) { return match; }
return '(?:\\/*){' + len + '}';
@@ -157,6 +152,7 @@ function expand(pattern, options) {
if (tok.is.globstar) {
glob.pattern = collapse(glob.pattern, '/**');
glob.pattern = collapse(glob.pattern, '**/');
glob._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true);
glob._replace(/\*{2,}/g, '**');
// 'foo/*'
@@ -184,7 +180,7 @@ function expand(pattern, options) {
glob._replace('?.', '?\\.', true);
glob._replace('?:', '?:', true);
glob._replace(/\?+/g, function (match) {
glob._replace(/\?+/g, function(match) {
var len = match.length;
if (len === 1) {
return qmark;
@@ -213,9 +209,7 @@ function expand(pattern, options) {
glob._replace('[^\\/]', qmark);
if (glob.pattern.length > 1) {
if (glob.pattern.indexOf('\\/') === 0 && glob.pattern.indexOf('\\/' + nodot) !== 0) {
glob.pattern = '\\/' + nodot + glob.pattern.slice(2);
} else if (/^[\[?*]/.test(glob.pattern)) {
if (/^[\[?*]/.test(glob.pattern)) {
// only prepend the string if we don't want to match dotfiles
glob.pattern = (opts.dot ? dotfiles : nodot) + glob.pattern;
}
@@ -224,18 +218,6 @@ function expand(pattern, options) {
return glob;
}
/**
* Special cases. This is somewhat of a placeholder
* for more advanced logic.
*/
function specialCase(glob) {
if (glob === '\\') {
return true;
}
return false;
}
/**
* Collapse repeated character sequences.
*
@@ -272,7 +254,7 @@ function collapse(str, ch) {
*/
function negateSlash(str) {
return str.replace(/\[\^([^\]]*?)\]/g, function (match, inner) {
return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) {
if (inner.indexOf('/') === -1) {
inner = '\\/' + inner;
}
@@ -304,6 +286,7 @@ function balance(str, a, b) {
* and speed up processing.
*/
/* eslint no-multi-spaces: 0 */
var qmark = '[^/]';
var star = qmark + '*?';
var nodot = '(?!\\.)(?=.)';

View File

@@ -1,24 +1,22 @@
'use strict';
var braces = require('braces');
var brackets = require('expand-brackets');
var extglob = require('extglob');
var parse = require('parse-glob');
var chars = require('./chars');
var utils = require('./utils');
/**
* Expose `Glob`
*/
module.exports = Glob;
function Glob(pattern, options) {
var Glob = module.exports = function Glob(pattern, options) {
if (!(this instanceof Glob)) {
return new Glob(pattern, options);
}
this.options = options || {};
this.pattern = pattern;
this.history = [];
this.tokens = {};
this.init(pattern);
}
};
/**
* Initialize defaults
@@ -42,31 +40,14 @@ Glob.prototype.track = function(msg) {
}
};
/**
* Return true if the glob pattern has the given
* `ch`aracter.
*
* @param {String} `pattern`
* @param {String} `ch`
* @return {Boolean}
*/
Glob.prototype.has = function(pattern, ch) {
if (ch instanceof RegExp) {
return ch.test(pattern);
}
return pattern.indexOf(ch) !== -1;
};
/**
* Return true if `glob.pattern` was negated
* with `!`. Also removes the `!` from the pattern.
* with `!`, also remove the `!` from the pattern.
*
* @return {Boolean}
*/
Glob.prototype.isNegated = function() {
if (this.tokens.isNegated) return true;
if (this.pattern.charCodeAt(0) === 33 /* '!' */) {
this.pattern = this.pattern.slice(1);
return true;
@@ -93,7 +74,7 @@ Glob.prototype.braces = function() {
}
// expand brace patterns and join the resulting array
var expanded = braces(this.pattern, this.options);
var expanded = utils.braces(this.pattern, this.options);
this.pattern = expanded.join('|');
}
};
@@ -104,7 +85,7 @@ Glob.prototype.braces = function() {
Glob.prototype.brackets = function() {
if (this.options.nobrackets !== true) {
this.pattern = brackets(this.pattern);
this.pattern = utils.brackets(this.pattern);
}
};
@@ -113,17 +94,19 @@ Glob.prototype.brackets = function() {
*/
Glob.prototype.extglob = function() {
if (this.options.noextglob !== true) {
this.pattern = extglob(this.pattern, {escape: true});
if (this.options.noextglob === true) return;
if (utils.isExtglob(this.pattern)) {
this.pattern = utils.extglob(this.pattern, {escape: true});
}
};
/**
* Parse the given glob `pattern` or `glob.pattern`
* Parse the given pattern
*/
Glob.prototype.parse = function(pattern) {
this.tokens = parse(pattern || this.pattern, true);
this.tokens = utils.parseGlob(pattern || this.pattern, true);
return this.tokens;
};
@@ -146,7 +129,7 @@ Glob.prototype._replace = function(a, b, escape) {
if (escape) b = esc(b);
if (a && b && typeof a === 'string') {
this.pattern = this.pattern.split(a).join(b);
} else if (a instanceof RegExp) {
} else {
this.pattern = this.pattern.replace(a, b);
}
this.track('after');

View File

@@ -1,33 +1,75 @@
'use strict';
var win32 = process && process.platform === 'win32';
var path = require('path');
var fileRe = require('filename-regex');
var win32 = process && process.platform === 'win32';
/**
* Expose `utils`
*/
var utils = module.exports;
/**
* Module dependencies
*/
utils.diff = require('arr-diff');
utils.unique = require('array-unique');
utils.braces = require('braces');
utils.brackets = require('expand-brackets');
utils.extglob = require('extglob');
utils.isExtglob = require('is-extglob');
utils.isGlob = require('is-glob');
utils.typeOf = require('kind-of');
utils.normalize = require('normalize-path');
utils.omit = require('object.omit');
utils.parseGlob = require('parse-glob');
utils.cache = require('regex-cache');
/**
* Get the filename of a filepath
*
* @param {String} `string`
* @return {String}
*/
utils.filename = function filename(fp) {
var seg = fp.match(fileRe());
return seg && seg[0];
};
/**
* Returns a function that returns true if the given
* pattern is the same as a given `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.isPath = function isPath(pattern, opts) {
return function (fp) {
return utils.unixify(fp, opts) === pattern;
return function(fp) {
return pattern === utils.unixify(fp, opts);
};
};
/**
* Returns a function that returns true if the given
* pattern contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.hasPath = function hasPath(pattern, opts) {
return function (fp) {
return utils.unixify(fp, opts).indexOf(pattern) !== -1;
return function(fp) {
return utils.unixify(pattern, opts).indexOf(fp) !== -1;
};
};
/**
* Returns a function that returns true if the given
* pattern matches or contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.matchPath = function matchPath(pattern, opts) {
var fn = (opts && opts.contains)
? utils.hasPath(pattern, opts)
@@ -35,8 +77,16 @@ utils.matchPath = function matchPath(pattern, opts) {
return fn;
};
/**
* Returns a function that returns true if the given
* regex matches the `filename` of a file path.
*
* @param {RegExp} `re`
* @return {Boolean}
*/
utils.hasFilename = function hasFilename(re) {
return function (fp) {
return function(fp) {
var name = utils.filename(fp);
return name && re.test(name);
};
@@ -63,7 +113,7 @@ utils.arrayify = function arrayify(val) {
utils.unixify = function unixify(fp, opts) {
if (opts && opts.unixify === false) return fp;
if (opts && opts.unixify === true || win32 || path.sep === '\\') {
return fp.split('\\').join('/');
return utils.normalize(fp, false);
}
if (opts && opts.unescape === true) {
return fp ? fp.toString().replace(/\\(\w)/g, '$1') : '';
@@ -86,3 +136,9 @@ utils.unescapeGlob = function unescapeGlob(fp) {
utils.escapeRe = function escapeRe(str) {
return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&');
};
/**
* Expose `utils`
*/
module.exports = utils;

View File

@@ -1,24 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015 Jon Schlinkert.
Copyright (c) 2014-2015, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,4 +1,4 @@
# arr-diff [![NPM version](https://badge.fury.io/js/arr-diff.svg)](http://badge.fury.io/js/arr-diff) [![Build Status](https://travis-ci.org/jonschlinkert/arr-diff.svg)](https://travis-ci.org/jonschlinkert/arr-diff)
# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg)](https://www.npmjs.com/package/arr-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/base.svg)](https://travis-ci.org/jonschlinkert/base)
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
@@ -9,7 +9,6 @@ Install with [npm](https://www.npmjs.com/)
```sh
$ npm i arr-diff --save
```
Install with [bower](http://bower.io/)
```sh
@@ -67,9 +66,9 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
## License
Copyright © 2015 Jon Schlinkert
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 23, 2015._
_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._

View File

@@ -8,7 +8,7 @@
'use strict';
var flatten = require('arr-flatten');
var slice = require('array-slice');
var slice = [].slice;
/**
* Return the difference between the first array and
@@ -40,7 +40,7 @@ function diff(arr, arrays) {
}
if (argsLen > 2) {
arrays = flatten(slice(arguments, 1));
arrays = flatten(slice.call(arguments, 1));
}
while (++i < len) {

View File

@@ -51,7 +51,7 @@
"gitHead": "7b3706eaa0093d8f5ba65af8ed590b6fcb3fe7cf",
"_id": "arr-flatten@1.0.1",
"_shasum": "e5ffe54d45e19f32f216e91eb99c8ce892bb604b",
"_from": "arr-flatten@>=1.0.1 <2.0.0",
"_from": "arr-flatten@^1.0.1",
"_npmVersion": "2.5.1",
"_nodeVersion": "0.12.0",
"_npmUser": {

View File

@@ -1,54 +0,0 @@
# array-slice [![NPM version](https://badge.fury.io/js/array-slice.svg)](http://badge.fury.io/js/array-slice) [![Build Status](https://travis-ci.org/jonschlinkert/array-slice.svg)](https://travis-ci.org/jonschlinkert/array-slice)
> Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.
This function is used instead of `Array#slice` to support node lists in IE < 9 and to ensure dense arrays are returned.
## Install with [npm](npmjs.org)
```bash
npm i array-slice --save
```
## Usage
```js
var slice = require('array-slice');
var arr = ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
slice(arr, 3, 6);
//=> ['e', 'f', 'g']
```
## Useful array utils
* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
* [arr-filter](https://github.com/jonschlinkert/arr-filter): Faster alternative to javascript's native filter method.
* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
* [arr-union](https://github.com/jonschlinkert/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.
* [array-unique](https://github.com/jonschlinkert/array-unique): Return an array free of duplicate values. Fastest ES5 implementation.
* [array-intersection](https://github.com/jonschlinkert/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality for comparisons.
## Running tests
Install dev dependencies:
```bash
npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/array-slice/issues)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 07, 2015._

View File

@@ -1,36 +0,0 @@
/*!
* array-slice <https://github.com/jonschlinkert/array-slice>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
module.exports = function slice(arr, start, end) {
var len = arr.length >>> 0;
var range = [];
start = idx(arr, start);
end = idx(arr, end, len);
while (start < end) {
range.push(arr[start++]);
}
return range;
};
function idx(arr, pos, end) {
var len = arr.length >>> 0;
if (pos == null) {
pos = end || 0;
} else if (pos < 0) {
pos = Math.max(len + pos, 0);
} else {
pos = Math.min(pos, len);
}
return pos;
}

View File

@@ -1,65 +0,0 @@
{
"name": "array-slice",
"description": "Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.",
"version": "0.2.3",
"homepage": "https://github.com/jonschlinkert/array-slice",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/array-slice.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/array-slice/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/array-slice/blob/master/LICENSE"
},
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"devDependencies": {
"mocha": "*",
"should": "^5.2.0"
},
"keywords": [
"array",
"javascript",
"js",
"slice",
"util",
"utils"
],
"gitHead": "15bcb1d3d2d5689a1f519207cecb3ab3a63b8654",
"_id": "array-slice@0.2.3",
"_shasum": "dd3cfb80ed7973a75117cdac69b0b99ec86186f5",
"_from": "array-slice@>=0.2.3 <0.3.0",
"_npmVersion": "2.5.1",
"_nodeVersion": "0.12.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"maintainers": [
{
"name": "jonschlinkert",
"email": "github@sellside.com"
}
],
"dist": {
"shasum": "dd3cfb80ed7973a75117cdac69b0b99ec86186f5",
"tarball": "http://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz"
}

View File

@@ -1,7 +1,7 @@
{
"name": "arr-diff",
"description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.",
"version": "1.1.0",
"version": "2.0.0",
"homepage": "https://github.com/jonschlinkert/arr-diff",
"author": {
"name": "Jon Schlinkert",
@@ -26,15 +26,15 @@
"test": "mocha"
},
"dependencies": {
"arr-flatten": "^1.0.1",
"array-slice": "^0.2.3"
"arr-flatten": "^1.0.1"
},
"devDependencies": {
"array-differ": "^1.0.0",
"array-slice": "^0.2.3",
"benchmarked": "^0.1.4",
"chalk": "^1.1.1",
"mocha": "^2.2.5",
"should": "^7.0.4"
"mocha": "*",
"should": "*"
},
"keywords": [
"arr",
@@ -52,26 +52,34 @@
]
}
},
"gitHead": "a749b8f9a21dae711050a14e580860abe7299a01",
"_id": "arr-diff@1.1.0",
"_shasum": "687c32758163588fef7de7b36fabe495eb1a399a",
"_from": "arr-diff@>=1.0.1 <2.0.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "0.12.4",
"gitHead": "b89f54eb88ca51afd0e0ea6be9a4a63e5ccecf27",
"_id": "arr-diff@2.0.0",
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"_from": "arr-diff@^2.0.0",
"_npmVersion": "3.3.6",
"_nodeVersion": "5.0.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"maintainers": [
{
"name": "doowb",
"email": "brian.woodward@gmail.com"
},
{
"name": "jonschlinkert",
"email": "github@sellside.com"
},
{
"name": "paulmillr",
"email": "paul@paulmillr.com"
}
],
"dist": {
"shasum": "687c32758163588fef7de7b36fabe495eb1a399a",
"tarball": "http://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz"
"shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"tarball": "http://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz"
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz"
}

View File

@@ -37,7 +37,7 @@
"gitHead": "36fde8e586fb7cf880b8b3aa6515df889e64ed85",
"_id": "array-unique@0.2.1",
"_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
"_from": "array-unique@>=0.2.1 <0.3.0",
"_from": "array-unique@^0.2.1",
"_npmVersion": "2.7.1",
"_nodeVersion": "1.6.2",
"_npmUser": {

View File

@@ -2,20 +2,18 @@
> Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.
- Complete support for the braces part of the [Bash 4.3 specification][bash]. Braces passes [all of the relevant unit tests](#bash-4-3-support) from the spec.
- Expands comma-separated values: `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
- Expands alphabetical or numerical ranges: `{1..3}` => `['1', '2', '3']`
- [Very fast](#benchmarks)
- [Special characters](./patterns.md) can be used to generate interesting patterns.
* Complete support for the braces part of the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/). Braces passes [all of the relevant unit tests](#bash-4-3-support) from the spec.
* Expands comma-separated values: `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
* Expands alphabetical or numerical ranges: `{1..3}` => `['1', '2', '3']`
* [Very fast](#benchmarks)
* [Special characters](./patterns.md) can be used to generate interesting patterns.
Install with [npm](https://www.npmjs.com/)
## Install with [npm](npmjs.org)
```bash
npm i braces --save
```sh
$ npm i braces --save
```
## Example usage
```js
@@ -52,7 +50,6 @@ braces('blah/{a..z}.js').forEach(function(fp) {
See the [tests](./test/test.js) for more examples and use cases (also see the [bash spec tests](./test/bash-mm-adjusted.js));
### Range expansion
Uses [expand-range](https://github.com/jonschlinkert/expand-range) for range expansion.
@@ -91,7 +88,7 @@ console.log(range);
//=> ['xa0y', 'xb1y', 'xc2y', 'xd3y', 'xe4y']
```
See [expand-range] for benchmarks, tests and the full list of range expansion features.
See [expand-range](https://github.com/jonschlinkert/expand-range)for benchmarks, tests and the full list of range expansion features.
## Options
@@ -128,7 +125,7 @@ Type: `Boolean`
Default: `false`
Enables complete support for the Bash specification. The downside is a 20-25% speed decrease.
Enables complete support for the Bash specification. The downside is a 20-25% speed decrease.
**Example**
@@ -154,14 +151,11 @@ Deafault: `true`
Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options
## Bash 4.3 Support
> Better support for Bash 4.3 than minimatch
This project has comprehensive unit tests, including tests coverted from [Bash 4.3][bash]. Currently only 8 of 102 unit tests fail, and
This project has comprehensive unit tests, including tests coverted from [Bash 4.3](www.gnu.org/software/bash/). Currently only 8 of 102 unit tests fail, and
## Run benchmarks
@@ -171,7 +165,6 @@ Install dev dependencies:
npm i -d && npm benchmark
```
```bash
#1: escape.js
brace-expansion.js x 114,934 ops/sec ±1.24% (93 runs sampled)
@@ -198,7 +191,6 @@ npm i -d && npm benchmark
braces.js x 1,108,353 ops/sec ±0.85% (94 runs sampled)
```
## Run tests
Install dev dependencies:
@@ -209,34 +201,30 @@ npm i -d && npm test
## Related
- [micromatch]: wildcard/glob matcher for javascript. a faster alternative to minimatch.
- [fill-range]: Fill in a range of numbers or letters, optionally passing an increment or multiplier to use
- [expand-range]: Wraps fill-range for fast, bash-like range expansion in strings. Expand a range of numbers or letters, uppercase or lowercase
* [micromatch](https://github.com/jonschlinkert/micromatch): wildcard/glob matcher for javascript. a faster alternative to minimatch.
* [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to use
* [expand-range](https://github.com/jonschlinkert/expand-range): Wraps fill-range for fast, bash-like range expansion in strings. Expand a range of numbers or letters, uppercase or lowercase
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/braces/issues).
Please run benchmarks before and after any code changes to what the impact of the code changes are before submitting a PR.
Please run benchmarks before and after any code changes to what the impact of the code changes are before submitting a PR.
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
Copyright © 2014-2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 18, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 19, 2015._
[bash]: www.gnu.org/software/bash/
[braces]: https://github.com/jonschlinkert/braces
[expand-range]: https://github.com/jonschlinkert/expand-range
[fill-range]: https://github.com/jonschlinkert/fill-range
[micromatch]: https://github.com/jonschlinkert/micromatch
[minimatch]: https://github.com/isaacs/minimatch
<!-- deps:mocha -->

View File

@@ -11,10 +11,9 @@
* Module dependencies
*/
var lazy = require('lazy-cache')(require);
lazy('expand-range', 'expand');
lazy('repeat-element', 'repeat');
lazy('preserve', 'tokens');
var expand = require('expand-range');
var repeat = require('repeat-element');
var tokens = require('preserve');
/**
* Expose `braces`
@@ -90,7 +89,7 @@ function braces(str, arr, options) {
return arr.concat(str);
} else {
es6 = true;
str = lazy.tokens.before(str, es6Regex());
str = tokens.before(str, es6Regex());
}
}
@@ -110,7 +109,7 @@ function braces(str, arr, options) {
var segs, segsLength;
if (inner.indexOf('..') !== -1) {
segs = lazy.expand(inner, opts, fn) || inner.split(',');
segs = expand(inner, opts, fn) || inner.split(',');
segsLength = segs.length;
} else if (inner[0] === '"' || inner[0] === '\'') {
@@ -148,7 +147,7 @@ function braces(str, arr, options) {
arr = braces(val, arr, opts);
} else if (val !== '') {
if (opts.nodupes && arr.indexOf(val) !== -1) { continue; }
arr.push(es6 ? lazy.tokens.after(val) : val);
arr.push(es6 ? tokens.after(val) : val);
}
}
@@ -198,7 +197,7 @@ function exponential(str, options, fn) {
} else {
var num = Math.pow(2, exp);
arr.push.apply(arr, lazy.repeat(ele, num));
arr.push.apply(arr, repeat(ele, num));
}
}
}

View File

@@ -1,17 +1,17 @@
# is-number [![NPM version](https://badge.fury.io/js/is-number.svg)](http://badge.fury.io/js/is-number) [![Build Status](https://travis-ci.org/jonschlinkert/is-number.svg)](https://travis-ci.org/jonschlinkert/is-number)
# is-number [![NPM version](https://badge.fury.io/js/is-number.svg)](http://badge.fury.io/js/is-number) [![Build Status](https://travis-ci.org/jonschlinkert/is-number.svg)](https://travis-ci.org/jonschlinkert/is-number)
> Returns true if the value is a number. comprehensive tests.
To understand some of the rationale behind the decisions made in this library (and to learn about some oddities of number evaluation in JavaScript), [see this gist][gist].
To understand some of the rationale behind the decisions made in this library (and to learn about some oddities of number evaluation in JavaScript), [see this gist](https://gist.github.com/jonschlinkert/e30c70c713da325d0e81).
## Install
## Install with [npm](npmjs.org)
Install with [npm](https://www.npmjs.com/)
```bash
npm i is-number --save
```sh
$ npm i is-number --save
```
## Usage
```js
@@ -66,39 +66,38 @@ isNumber({abc: 'abc'}) //=> 'false'
```
## Other projects
* [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value.
* [is-primitive](https://github.com/jonschlinkert/is-primitive): Returns `true` if the value is a primitive.
* [even](https://github.com/jonschlinkert/even): Get the even numbered items from an array.
* [odd](https://github.com/jonschlinkert/odd): Get the odd numbered items from an array.
* [is-even](https://github.com/jonschlinkert/is-even): Return true if the given number is even.
* [is-odd](https://github.com/jonschlinkert/is-odd): Returns true if the given number is odd.
* [even](https://www.npmjs.com/package/even): Get the even numbered items from an array. | [homepage](https://github.com/jonschlinkert/even)
* [is-even](https://www.npmjs.com/package/is-even): Return true if the given number is even. | [homepage](https://github.com/jonschlinkert/is-even)
* [is-odd](https://www.npmjs.com/package/is-odd): Returns true if the given number is odd. | [homepage](https://github.com/jonschlinkert/is-odd)
* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive)
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of)
* [odd](https://www.npmjs.com/package/odd): Get the odd numbered items from an array. | [homepage](https://github.com/jonschlinkert/odd)
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-number/issues)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-number/issues/new).
## Run tests
Install dev dependencies.
```bash
npm i -d && npm test
Install dev dependencies:
```sh
$ npm i -d && npm test
```
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 05, 2015._
[infinity]: http://en.wikipedia.org/wiki/Infinity
[gist]: https://gist.github.com/jonschlinkert/e30c70c713da325d0e81
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 22, 2015._

View File

@@ -7,8 +7,13 @@
'use strict';
module.exports = function isNumber(n) {
return (!!(+n) && !Array.isArray(n)) && isFinite(n)
|| n === '0'
|| n === 0;
var typeOf = require('kind-of');
module.exports = function isNumber(num) {
var type = typeOf(num);
if (type !== 'number' && type !== 'string') {
return false;
}
var n = +num;
return (n - n + 1) >= 0 && num !== '';
};

View File

@@ -1,7 +1,7 @@
{
"name": "is-number",
"description": "Returns true if the value is a number. comprehensive tests.",
"version": "1.1.2",
"version": "2.1.0",
"homepage": "https://github.com/jonschlinkert/is-number",
"author": {
"name": "Jon Schlinkert",
@@ -9,15 +9,12 @@
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/is-number.git"
"url": "git+https://github.com/jonschlinkert/is-number.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/is-number/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/is-number/blob/master/LICENSE"
},
"license": "MIT",
"files": [
"index.js"
],
@@ -28,18 +25,21 @@
"scripts": {
"test": "mocha"
},
"dependencies": {
"kind-of": "^3.0.2"
},
"devDependencies": {
"benchmarked": "^0.1.3",
"chalk": "^0.5.1",
"mocha": "^2.1.0"
"mocha": "*"
},
"keywords": [
"check",
"coerce",
"coercion",
"integer",
"is number",
"is",
"is number",
"is-number",
"istype",
"kind of",
@@ -50,12 +50,24 @@
"typeof",
"value"
],
"gitHead": "a902495bca1f471beaa8deb6193ba628bf80c0e4",
"_id": "is-number@1.1.2",
"_shasum": "9d82409f3a8a8beecf249b1bc7dada49829966e4",
"_from": "is-number@>=1.1.2 <2.0.0",
"_npmVersion": "2.5.1",
"_nodeVersion": "0.12.0",
"verb": {
"related": {
"list": [
"kind-of",
"is-primitive",
"even",
"odd",
"is-even",
"is-odd"
]
}
},
"gitHead": "d06c6e2cc048d3cad016cb8dfb055bb14d86fffa",
"_id": "is-number@2.1.0",
"_shasum": "01fcbbb393463a548f2f466cce16dece49db908f",
"_from": "is-number@^2.1.0",
"_npmVersion": "3.3.6",
"_nodeVersion": "5.0.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
@@ -64,12 +76,16 @@
{
"name": "jonschlinkert",
"email": "github@sellside.com"
},
{
"name": "doowb",
"email": "brian.woodward@gmail.com"
}
],
"dist": {
"shasum": "9d82409f3a8a8beecf249b1bc7dada49829966e4",
"tarball": "http://registry.npmjs.org/is-number/-/is-number-1.1.2.tgz"
"shasum": "01fcbbb393463a548f2f466cce16dece49db908f",
"tarball": "http://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/is-number/-/is-number-1.1.2.tgz"
"_resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz"
}

View File

@@ -74,8 +74,8 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
## License
Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the [MIT](https://github.com/jonschlinkert/isobject/blob/master/LICENSE) license.
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 13, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 20, 2015._

View File

@@ -7,7 +7,8 @@
'use strict';
module.exports = function isObject(val) {
return val != null && typeof val === 'object'
&& !Array.isArray(val);
var isArray = require('isarray');
module.exports = function isObject(o) {
return o != null && typeof o === 'object' && !isArray(o);
};

View File

@@ -0,0 +1,54 @@
# isarray
`Array#isArray` for older browsers.
## Usage
```js
var isArray = require('isarray');
console.log(isArray([])); // => true
console.log(isArray({})); // => false
```
## Installation
With [npm](http://npmjs.org) do
```bash
$ npm install isarray
```
Then bundle for the browser with
[browserify](https://github.com/substack/browserify).
With [component](http://component.io) do
```bash
$ component install juliangruber/isarray
```
## License
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,209 @@
/**
* Require the given path.
*
* @param {String} path
* @return {Object} exports
* @api public
*/
function require(path, parent, orig) {
var resolved = require.resolve(path);
// lookup failed
if (null == resolved) {
orig = orig || path;
parent = parent || 'root';
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
err.path = orig;
err.parent = parent;
err.require = true;
throw err;
}
var module = require.modules[resolved];
// perform real require()
// by invoking the module's
// registered function
if (!module.exports) {
module.exports = {};
module.client = module.component = true;
module.call(this, module.exports, require.relative(resolved), module);
}
return module.exports;
}
/**
* Registered modules.
*/
require.modules = {};
/**
* Registered aliases.
*/
require.aliases = {};
/**
* Resolve `path`.
*
* Lookup:
*
* - PATH/index.js
* - PATH.js
* - PATH
*
* @param {String} path
* @return {String} path or null
* @api private
*/
require.resolve = function(path) {
if (path.charAt(0) === '/') path = path.slice(1);
var index = path + '/index.js';
var paths = [
path,
path + '.js',
path + '.json',
path + '/index.js',
path + '/index.json'
];
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
if (require.modules.hasOwnProperty(path)) return path;
}
if (require.aliases.hasOwnProperty(index)) {
return require.aliases[index];
}
};
/**
* Normalize `path` relative to the current path.
*
* @param {String} curr
* @param {String} path
* @return {String}
* @api private
*/
require.normalize = function(curr, path) {
var segs = [];
if ('.' != path.charAt(0)) return path;
curr = curr.split('/');
path = path.split('/');
for (var i = 0; i < path.length; ++i) {
if ('..' == path[i]) {
curr.pop();
} else if ('.' != path[i] && '' != path[i]) {
segs.push(path[i]);
}
}
return curr.concat(segs).join('/');
};
/**
* Register module at `path` with callback `definition`.
*
* @param {String} path
* @param {Function} definition
* @api private
*/
require.register = function(path, definition) {
require.modules[path] = definition;
};
/**
* Alias a module definition.
*
* @param {String} from
* @param {String} to
* @api private
*/
require.alias = function(from, to) {
if (!require.modules.hasOwnProperty(from)) {
throw new Error('Failed to alias "' + from + '", it does not exist');
}
require.aliases[to] = from;
};
/**
* Return a require function relative to the `parent` path.
*
* @param {String} parent
* @return {Function}
* @api private
*/
require.relative = function(parent) {
var p = require.normalize(parent, '..');
/**
* lastIndexOf helper.
*/
function lastIndexOf(arr, obj) {
var i = arr.length;
while (i--) {
if (arr[i] === obj) return i;
}
return -1;
}
/**
* The relative require() itself.
*/
function localRequire(path) {
var resolved = localRequire.resolve(path);
return require(resolved, parent, path);
}
/**
* Resolve relative to the parent.
*/
localRequire.resolve = function(path) {
var c = path.charAt(0);
if ('/' == c) return path.slice(1);
if ('.' == c) return require.normalize(p, path);
// resolve deps by returning
// the dep in the nearest "deps"
// directory
var segs = parent.split('/');
var i = lastIndexOf(segs, 'deps') + 1;
if (!i) i = 0;
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
return path;
};
/**
* Check if module is defined at `path`.
*/
localRequire.exists = function(path) {
return require.modules.hasOwnProperty(localRequire.resolve(path));
};
return localRequire;
};
require.register("isarray/index.js", function(exports, require, module){
module.exports = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]';
};
});
require.alias("isarray/index.js", "isarray/index.js");

View File

@@ -0,0 +1,19 @@
{
"name" : "isarray",
"description" : "Array#isArray for older browsers",
"version" : "0.0.1",
"repository" : "juliangruber/isarray",
"homepage": "https://github.com/juliangruber/isarray",
"main" : "index.js",
"scripts" : [
"index.js"
],
"dependencies" : {},
"keywords": ["browser","isarray","array"],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT"
}

View File

@@ -0,0 +1,3 @@
module.exports = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]';
};

View File

@@ -0,0 +1,53 @@
{
"name": "isarray",
"description": "Array#isArray for older browsers",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/isarray.git"
},
"homepage": "https://github.com/juliangruber/isarray",
"main": "index.js",
"scripts": {
"test": "tap test/*.js"
},
"dependencies": {},
"devDependencies": {
"tap": "*"
},
"keywords": [
"browser",
"isarray",
"array"
],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT",
"_id": "isarray@0.0.1",
"dist": {
"shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
"tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"_from": "isarray@0.0.1",
"_npmVersion": "1.2.18",
"_npmUser": {
"name": "juliangruber",
"email": "julian@juliangruber.com"
},
"maintainers": [
{
"name": "juliangruber",
"email": "julian@juliangruber.com"
}
],
"directories": {},
"_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"bugs": {
"url": "https://github.com/juliangruber/isarray/issues"
},
"readme": "ERROR: No README data found!"
}

View File

@@ -1,7 +1,7 @@
{
"name": "isobject",
"description": "Returns true if the value is an object and not an array or null.",
"version": "1.0.2",
"version": "2.0.0",
"homepage": "https://github.com/jonschlinkert/isobject",
"author": {
"name": "Jon Schlinkert",
@@ -9,15 +9,12 @@
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/isobject.git"
"url": "git+https://github.com/jonschlinkert/isobject.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/isobject/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/isobject/blob/master/LICENSE"
},
"license": "MIT",
"files": [
"index.js"
],
@@ -28,31 +25,42 @@
"scripts": {
"test": "mocha"
},
"dependencies": {
"isarray": "0.0.1"
},
"devDependencies": {
"mocha": "*"
},
"keywords": [
"check",
"function",
"is",
"is-object",
"isobject",
"javascript",
"kind",
"kind-of",
"kindof",
"native",
"object",
"of",
"type",
"typeof",
"validate",
"value"
],
"gitHead": "0d3070262eb950e2e19c5781da8f243b629c7731",
"_id": "isobject@1.0.2",
"_shasum": "f0f9b8ce92dd540fa0740882e3835a2e022ec78a",
"_from": "isobject@>=1.0.0 <2.0.0",
"verb": {
"related": {
"list": [
"is-plain-object",
"kind-of",
"is-extendable",
"is-equal-shallow",
"extend-shallow",
"assign-deep"
]
}
},
"gitHead": "563423a8cd174564f2cf758358c690b0d3a5e5c2",
"_id": "isobject@2.0.0",
"_shasum": "208de872bd7378c2a92af9428a3f56eb91a122c4",
"_from": "isobject@^2.0.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "0.12.4",
"_npmUser": {
@@ -66,10 +74,9 @@
}
],
"dist": {
"shasum": "f0f9b8ce92dd540fa0740882e3835a2e022ec78a",
"tarball": "http://registry.npmjs.org/isobject/-/isobject-1.0.2.tgz"
"shasum": "208de872bd7378c2a92af9428a3f56eb91a122c4",
"tarball": "http://registry.npmjs.org/isobject/-/isobject-2.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/isobject/-/isobject-1.0.2.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/isobject/-/isobject-2.0.0.tgz"
}

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2014-2015, Jon Schlinkert.
Copyright (c) 2013-2015, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,18 +1,20 @@
# randomatic [![NPM version](https://badge.fury.io/js/randomatic.svg)](http://badge.fury.io/js/randomatic)
# randomatic [![NPM version](https://img.shields.io/npm/v/randomatic.svg)](https://www.npmjs.com/package/randomatic)
> Generate randomized strings of a specified length, fast. Only the length is necessary, but you can optionally generate patterns using any combination of numeric, alpha-numeric, alphabetical, special or custom characters.
## Install with [npm](npmjs.org)
## Install
```bash
npm i randomatic --save
```
### Install with [bower](https://github.com/bower/bower)
Install with [npm](https://www.npmjs.com/)
```bash
bower install randomatic --save
```sh
$ npm i randomatic --save
```
Install with [bower](http://bower.io/)
```sh
$ bower install randomatic --save
```
## Usage
@@ -20,16 +22,14 @@ bower install randomatic --save
var randomize = require('randomatic');
```
## API
```
```js
randomize(pattern, length, options);
```
- `pattern` **{String}**: The pattern to use for randomizing
- `length` **{Object}**: The length of the string to generate
* `pattern` **{String}**: The pattern to use for randomizing
* `length` **{Object}**: The length of the string to generate
### pattern
@@ -56,7 +56,6 @@ randomize('Aa0!', 10);
* `*`: All characters (all of the above combined)
* `?`: Custom characters (pass a string of custom characters to the options)
### length
> the length of the string to generate
@@ -71,18 +70,17 @@ randomize('Aa0!', 10);
If `length` is left undefined, the length of the pattern in the first parameter will be used. For example:
* `randomize('00')` will generate a 2-digit random number
+ `randomize('00')` will generate a 2-digit random number
* `randomize('000')` will generate a 3-digit random number
* `randomize('0000')` will generate a 4-digit random number...
* `randomize('AAAAA')` will generate a 5-character, uppercase alphabetical random string...
These are just examples, [see the tests](./test.js) for more use cases and examples.
## options
#### chars
Type: `String`
Default: `undefined`
@@ -94,8 +92,6 @@ Define a custom string to be randomized.
* `randomize('?', 20, {chars: 'jonschlinkert'})` will generate a 20-character randomized string from the letters contained in `jonschlinkert`.
* `randomize('?', {chars: 'jonschlinkert'})` will generate a 13-character randomized string from the letters contained in `jonschlinkert`.
## Usage Examples
* `randomize('A', 4)` (_whitespace insenstive_) would result in randomized 4-digit uppercase letters, like, `ZAKH`, `UJSL`... etc.
@@ -109,30 +105,28 @@ Define a custom string to be randomized.
_The order in which the characters are defined is insignificant._
## Related
## Running tests
Install dev dependencies:
```bash
npm install -d && mocha
```
* [pad-left](https://www.npmjs.com/package/pad-left): Left pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-left)
* [pad-right](https://www.npmjs.com/package/pad-right): Right pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-right)
* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string)
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/randomatic/issues)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/randomatic/issues/new).
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
***
_This file was generated by [verb](https://github.com/assemble/verb) on January 26, 2015._
_This file was generated by [verb](https://github.com/verbose/verb) on December 10, 2015._

View File

@@ -1,11 +1,9 @@
/*!
* randomatic <https://github.com/jonschlinkert/randomatic>
*
* This was originally inspired by <http://stackoverflow.com/a/10727155/1267639>
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License (MIT)
*
* Many changes have been made, but this was originally
* inspired by <http://stackoverflow.com/a/10727155/1267639>
*/
'use strict';
@@ -58,7 +56,7 @@ function randomatic(pattern, length, options) {
}
}
if(typeOf(length) === 'object' && length.hasOwnProperty('chars')) {
if (typeOf(length) === 'object' && length.hasOwnProperty('chars')) {
options = length;
pattern = options.chars;
length = pattern.length;
@@ -79,8 +77,7 @@ function randomatic(pattern, length, options) {
if (custom) mask += pattern;
while (length--) {
res += mask.charAt(parseInt(Math.random() * mask.length));
res += mask.charAt(parseInt(Math.random() * mask.length, 10));
}
return res;
};

View File

@@ -1,7 +1,7 @@
{
"name": "randomatic",
"description": "Generate randomized strings of a specified length, fast. Only the length is necessary, but you can optionally generate patterns using any combination of numeric, alpha-numeric, alphabetical, special or custom characters.",
"version": "1.1.0",
"version": "1.1.5",
"homepage": "https://github.com/jonschlinkert/randomatic",
"author": {
"name": "Jon Schlinkert",
@@ -9,31 +9,29 @@
},
"repository": {
"type": "git",
"url": "https://github.com/jonschlinkert/randomatic.git"
"url": "git+https://github.com/jonschlinkert/randomatic.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/randomatic/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/randomatic/blob/master/LICENSE-MIT"
},
"scripts": {
"test": "mocha -R spec"
},
"main": "index.js",
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"scripts": {
"test": "mocha"
},
"dependencies": {
"is-number": "^1.1.0",
"kind-of": "^1.0.0"
"is-number": "^2.0.2",
"kind-of": "^3.0.2"
},
"devDependencies": {
"benchmarked": "^0.1.3",
"chalk": "^0.5.1",
"glob": "^4.3.5",
"should": "^4.4.1"
"ansi-bold": "^0.1.1",
"benchmarked": "^0.1.4",
"glob": "^5.0.15",
"mocha": "*",
"should": "*"
},
"keywords": [
"alpha",
@@ -47,11 +45,24 @@
"randomize",
"randomized"
],
"gitHead": "ca326363bee58a3eb2556a5805822ffbf328397e",
"_id": "randomatic@1.1.0",
"_shasum": "2ca36b9f93747aac985eb242749af88b45d5d42d",
"_from": "randomatic@>=1.1.0 <2.0.0",
"_npmVersion": "1.4.28",
"verb": {
"related": {
"list": [
"repeat-string",
"pad-left",
"pad-right"
]
},
"plugins": [
"gulp-format-md"
]
},
"gitHead": "8d74759d683a580412484e95ec5f1b87d93fd50c",
"_id": "randomatic@1.1.5",
"_shasum": "5e9ef5f2d573c67bd2b8124ae90b5156e457840b",
"_from": "randomatic@^1.1.3",
"_npmVersion": "3.3.6",
"_nodeVersion": "5.0.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
@@ -63,9 +74,9 @@
}
],
"dist": {
"shasum": "2ca36b9f93747aac985eb242749af88b45d5d42d",
"tarball": "http://registry.npmjs.org/randomatic/-/randomatic-1.1.0.tgz"
"shasum": "5e9ef5f2d573c67bd2b8124ae90b5156e457840b",
"tarball": "http://registry.npmjs.org/randomatic/-/randomatic-1.1.5.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.0.tgz"
"_resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.5.tgz"
}

View File

@@ -56,7 +56,7 @@
"gitHead": "bf20e5dc1414305bec6ff26d90988378a5bad6ec",
"_id": "repeat-string@1.5.2",
"_shasum": "21065f70727ad053a0dd5e957ac9e00c7560d90a",
"_from": "repeat-string@>=1.5.2 <2.0.0",
"_from": "repeat-string@^1.5.2",
"_npmVersion": "2.5.1",
"_nodeVersion": "0.12.0",
"_npmUser": {

View File

@@ -1,7 +1,7 @@
{
"name": "fill-range",
"description": "Fill in a range of numbers or letters, optionally passing an increment or multiplier to use.",
"version": "2.2.2",
"version": "2.2.3",
"homepage": "https://github.com/jonschlinkert/fill-range",
"author": {
"name": "Jon Schlinkert",
@@ -9,15 +9,12 @@
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/fill-range.git"
"url": "git+https://github.com/jonschlinkert/fill-range.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/fill-range/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/fill-range/blob/master/LICENSE"
},
"license": "MIT",
"files": [
"index.js"
],
@@ -29,10 +26,10 @@
"test": "mocha"
},
"dependencies": {
"is-number": "^1.1.2",
"isobject": "^1.0.0",
"randomatic": "^1.1.0",
"repeat-element": "^1.1.0",
"is-number": "^2.1.0",
"isobject": "^2.0.0",
"randomatic": "^1.1.3",
"repeat-element": "^1.1.2",
"repeat-string": "^1.5.2"
},
"devDependencies": {
@@ -57,12 +54,22 @@
"ranges",
"sh"
],
"gitHead": "dafcb07a8cb9d8138543234fde0cc92340248cb1",
"_id": "fill-range@2.2.2",
"_shasum": "2ad9d158a6a666f9fb8c9f9f05345dff68d45760",
"_from": "fill-range@>=2.1.0 <3.0.0",
"_npmVersion": "2.5.1",
"_nodeVersion": "0.12.0",
"verb": {
"related": {
"list": [
"micromatch",
"expand-range",
"braces",
"is-glob"
]
}
},
"gitHead": "6cb50d5c679d9e6d9e8ad97bb2efd63a8c8da610",
"_id": "fill-range@2.2.3",
"_shasum": "50b77dfd7e469bc7492470963699fe7a8485a723",
"_from": "fill-range@^2.1.0",
"_npmVersion": "3.3.6",
"_nodeVersion": "5.0.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
@@ -82,9 +89,9 @@
}
],
"dist": {
"shasum": "2ad9d158a6a666f9fb8c9f9f05345dff68d45760",
"tarball": "http://registry.npmjs.org/fill-range/-/fill-range-2.2.2.tgz"
"shasum": "50b77dfd7e469bc7492470963699fe7a8485a723",
"tarball": "http://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.2.tgz"
"_resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz"
}

View File

@@ -59,7 +59,7 @@
"gitHead": "de01a2ae06e6fe9c69812595c439870cca71839f",
"_id": "expand-range@1.8.1",
"_shasum": "acbd63e56efd9139722b755f099b9db5ac1f33f6",
"_from": "expand-range@>=1.8.1 <2.0.0",
"_from": "expand-range@^1.8.1",
"_npmVersion": "2.5.1",
"_nodeVersion": "0.12.0",
"_npmUser": {

Some files were not shown because too many files have changed in this diff Show More