UNPKG

motion

Version:

motion - moving development forward

79 lines (78 loc) 5.97 kB
{ "_args": [ [ "anymatch@https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", "/Users/nw/flint/packages/flint" ] ], "_from": "anymatch@>=1.3.0 <2.0.0", "_id": "anymatch@1.3.0", "_inCache": true, "_location": "/anymatch", "_phantomChildren": {}, "_requested": { "name": "anymatch", "raw": "anymatch@https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", "rawSpec": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", "scope": null, "spec": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", "type": "remote" }, "_requiredBy": [ "/chokidar", "/gulp-watch" ], "_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", "_shasum": "a3e52fa39168c825ff57b0248126ce5a8ff95507", "_shrinkwrap": null, "_spec": "anymatch@https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", "_where": "/Users/nw/flint/packages/flint", "author": { "name": "Elan Shanker", "url": "http://github.com/es128" }, "bugs": { "url": "https://github.com/es128/anymatch/issues" }, "dependencies": { "arrify": "^1.0.0", "micromatch": "^2.1.5" }, "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", "devDependencies": { "coveralls": "^2.11.2", "istanbul": "^0.3.13", "mocha": "^2.2.4" }, "files": [ "index.js" ], "homepage": "https://github.com/es128/anymatch", "keywords": [ "any", "expression", "file", "fs", "function", "glob", "list", "match", "regex", "regexp", "regular", "string" ], "license": "ISC", "name": "anymatch", "optionalDependencies": {}, "readme": "anymatch [![Build Status](https://travis-ci.org/es128/anymatch.svg?branch=master)](https://travis-ci.org/es128/anymatch) [![Coverage Status](https://img.shields.io/coveralls/es128/anymatch.svg?branch=master)](https://coveralls.io/r/es128/anymatch?branch=master)\n======\nJavascript module to match a string against a regular expression, glob, string,\nor function that takes the string as an argument and returns a truthy or falsy\nvalue. The matcher can also be an array of any or all of these. Useful for\nallowing a very flexible user-defined config to define things like file paths.\n\n[![NPM](https://nodei.co/npm/anymatch.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/anymatch/)\n[![NPM](https://nodei.co/npm-dl/anymatch.png?height=3&months=9)](https://nodei.co/npm-dl/anymatch/)\n\nUsage\n-----\n```sh\nnpm install anymatch --save\n```\n\n#### anymatch (matchers, testString, [returnIndex], [startIndex], [endIndex])\n* __matchers__: (_Array|String|RegExp|Function_)\nString to be directly matched, string with glob patterns, regular expression\ntest, function that takes the testString as an argument and returns a truthy\nvalue if it should be matched, or an array of any number and mix of these types.\n* __testString__: (_String|Array_) The string to test against the matchers. If\npassed as an array, the first element of the array will be used as the\n`testString` for non-function matchers, while the entire array will be applied\nas the arguments for function matchers.\n* __returnIndex__: (_Boolean [optional]_) If true, return the array index of\nthe first matcher that that testString matched, or -1 if no match, instead of a\nboolean result.\n* __startIndex, endIndex__: (_Integer [optional]_) Can be used to define a\nsubset out of the array of provided matchers to test against. Can be useful\nwith bound matcher functions (see below). When used with `returnIndex = true`\npreserves original indexing. Behaves the same as `Array.prototype.slice` (i.e.\nincludes array members up to, but not including endIndex).\n\n```js\nvar anymatch = require('anymatch');\n\nvar matchers = [\n\t'path/to/file.js',\n\t'path/anyjs/**/*.js',\n\t/foo.js$/,\n\tfunction (string) {\n\t\treturn string.indexOf('bar') !== -1 && string.length > 10\n\t}\n];\n\nanymatch(matchers, 'path/to/file.js'); // true\nanymatch(matchers, 'path/anyjs/baz.js'); // true\nanymatch(matchers, 'path/to/foo.js'); // true\nanymatch(matchers, 'path/to/bar.js'); // true\nanymatch(matchers, 'bar.js'); // false\n\n// returnIndex = true\nanymatch(matchers, 'foo.js', true); // 2\nanymatch(matchers, 'path/anyjs/foo.js', true); // 1\n\n// skip matchers\nanymatch(matchers, 'path/to/file.js', false, 1); // false\nanymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2\nanymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1\n```\n\n#### anymatch (matchers)\nYou can also pass in only your matcher(s) to get a curried function that has\nalready been bound to the provided matching criteria. This can be used as an\n`Array.prototype.filter` callback.\n\n```js\nvar matcher = anymatch(matchers);\n\nmatcher('path/to/file.js'); // true\nmatcher('path/anyjs/baz.js', true); // 1\nmatcher('path/anyjs/baz.js', true, 2); // -1\n\n['foo.js', 'bar.js'].filter(matcher); // ['foo.js']\n```\n\nChange Log\n----------\n[See release notes page on GitHub](https://github.com/es128/anymatch/releases)\n\nNOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)\nfor glob pattern matching. The glob matching behavior should be functionally\nequivalent to the commonly used [minimatch](https://github.com/isaacs/minimatch)\nlibrary (aside from some fixed bugs and greater performance), so a major\nversion bump wasn't merited. Issues with glob pattern matching should be\nreported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).\n\nLicense\n-------\n[ISC](https://raw.github.com/es128/anymatch/master/LICENSE)\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/es128/anymatch.git" }, "scripts": { "test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls" }, "version": "1.3.0" }