GT2/GT2-Android/node_modules/xregexp/package.json

96 lines
13 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"_args": [
[
{
"raw": "xregexp@2.0.0",
"scope": null,
"escapedName": "xregexp",
"name": "xregexp",
"rawSpec": "2.0.0",
"spec": "2.0.0",
"type": "version"
},
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/ftp"
]
],
"_defaultsLoaded": true,
"_engineSupported": true,
"_from": "xregexp@2.0.0",
"_id": "xregexp@2.0.0",
"_inCache": true,
"_location": "/xregexp",
"_nodeVersion": "v0.6.18",
"_npmUser": {
"name": "slevithan",
"email": "steves_list@hotmail.com"
},
"_npmVersion": "1.1.21",
"_phantomChildren": {},
"_requested": {
"raw": "xregexp@2.0.0",
"scope": null,
"escapedName": "xregexp",
"name": "xregexp",
"rawSpec": "2.0.0",
"spec": "2.0.0",
"type": "version"
},
"_requiredBy": [
"/ftp"
],
"_resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
"_shasum": "52a63e56ca0b84a7f3a5f3d61872f126ad7a5943",
"_shrinkwrap": null,
"_spec": "xregexp@2.0.0",
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/ftp",
"author": {
"name": "Steven Levithan",
"email": "steves_list@hotmail.com"
},
"bugs": {
"url": "https://github.com/slevithan/XRegExp/issues"
},
"dependencies": {},
"description": "Extended JavaScript regular expressions",
"devDependencies": {
"qunit": ">= 0.2.x"
},
"directories": {},
"dist": {
"shasum": "52a63e56ca0b84a7f3a5f3d61872f126ad7a5943",
"tarball": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz"
},
"engines": {
"node": "*"
},
"homepage": "http://xregexp.com/",
"keywords": [
"regex",
"regexp"
],
"license": "MIT",
"main": "./xregexp-all.js",
"maintainers": [
{
"name": "walling",
"email": "bwp@bwp.dk"
},
{
"name": "slevithan",
"email": "steves_list@hotmail.com"
}
],
"name": "xregexp",
"optionalDependencies": {},
"readme": "[XRegExp](http://xregexp.com/)\r\n==============================\r\n\r\nXRegExp provides augmented, extensible, cross-browser JavaScript regular expressions. You get new syntax and flags beyond what browsers support natively, along with a collection of utils to make your client-side grepping and parsing easier. XRegExp also frees you from worrying about pesky inconsistencies in cross-browser regex handling and the dubious `lastIndex` property.\r\n\r\nXRegExp supports all native ES5 regular expression syntax. It's about 3.5 KB when minified and gzipped. It works with Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 9.5+.\r\n\r\n\r\n## Performance\r\n\r\nXRegExp regular expressions compile to native RegExp objects, thus there is no performance difference when using XRegExp objects with native methods. There is a small performance cost when *compiling* XRegExps. If you want, however, you can use `XRegExp.cache` to avoid ever incurring the compilation cost for a given pattern more than once. Doing so can even lead to XRegExp being faster than native regexes in synthetic tests that repeatedly compile the same regex.\r\n\r\n\r\n## Usage examples\r\n\r\n~~~ js\r\n// Using named capture and flag x (free-spacing and line comments)\r\nvar date = XRegExp('(?<year> [0-9]{4}) -? # year \\n\\\r\n (?<month> [0-9]{2}) -? # month \\n\\\r\n (?<day> [0-9]{2}) # day ', 'x');\r\n\r\n// XRegExp.exec gives you named backreferences on the match result\r\nvar match = XRegExp.exec('2012-02-22', date);\r\nmatch.day; // -> '22'\r\n\r\n// It also includes optional pos and sticky arguments\r\nvar pos = 3, result = [];\r\nwhile (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\\d+)>/, pos, 'sticky')) {\r\n result.push(match[1]);\r\n pos = match.index + match[0].length;\r\n} // result -> ['2', '3', '4']\r\n\r\n// XRegExp.replace allows named backreferences in replacements\r\nXRegExp.replace('2012-02-22', date, '${month}/${day}/${year}'); // -> '02/22/2012'\r\nXRegExp.replace('2012-02-22', date, function (match) {\r\n return match.month + '/' + match.day + '/' + match.year;\r\n}); // -> '02/22/2012'\r\n\r\n// In fact, all XRegExps are RegExps and work perfectly with native methods\r\ndate.test('2012-02-22'); // -> true\r\n\r\n// The *only* caveat is that named captures must be referred to using numbered backreferences\r\n'2012-02-22'.replace(date, '$2/$3/$1'); // -> '02/22/2012'\r\n\r\n// If you want, you can extend native methods so you don't have to worry about this\r\n// Doing so also fixes numerous browser bugs in the native methods\r\nXRegExp.install('natives');\r\n'2012-02-22'.replace(date, '${month}/${day}/${year}'); // -> '02/22/2012'\r\n'2012-02-22'.replace(date, function (match) {\r\n return match.month + '/' + match.day + '/' + match.year;\r\n}); // -> '02/22/2012'\r\ndate.exec('2012-02-22').day; // -> '22'\r\n\r\n// Extract every other digit from a string using XRegExp.forEach\r\nXRegExp.forEach('1a2345', /\\d/, function (match, i) {\r\n if (i % 2) this.push(+match[0]);\r\n}, []); // -> [2, 4]\r\n\r\n// Get numbers within <b> tags using XRegExp.matchChain\r\nXRegExp.matchChain('1 <b>2</b> 3 <b>4 a 56</b>', [\r\n XRegExp('(?is)<b>.*?</b>'),\r\n /\\d+/\r\n]); // -> ['2', '4', '56']\r\n\r\n// You can also pass forward and return specific backreferences\r\nvar html = '<a href=\"http://xregexp.com/\">XRegExp</a>\\\r\n <a href=\"http://www.google.com/\">Google</a>';\r\nXRegExp.matchChain(html, [\r\n {regex: /<a href=\"([^\"]+)\">/i, backref: 1},\r\n {regex: XRegExp('(?i)^https?://(?<domain>[^/?#]+)'), backref: 'domain'}\r\n]); // -> ['xregexp.com', 'www.google.com']\r\n\r\n// XRegExp.union safely merges strings and regexes into a single pattern\r\nXRegExp.union(['a+b*c', /(dogs)\\1/, /(cats)\\1/], 'i');\r\n// -> /a\\+b\\*c|(dogs)\\1|(cats)\\2/i\r\n~~~\r\n\r\nThese examples should give you the flavor of what's possible, but XRegExp has more syntax, flags, utils, options, and browser fixes that aren't shown here. You can even augment XRegExp's regular expression syntax with addons (see below) or write your own. See [xregexp.com](http://xregexp.com/) for more details.\r\n\r\n\r\n## Addons\r\n\r\nIn browsers, you can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm](http://npmjs.org/) package uses `xregexp-all.js`, which means that the addons are always available when XRegExp is installed on the server using npm.\r\n\r\n\r\n### XRegExp Unicode Base\r\n\r\nIn browsers, first include the Unicode Base script:\r\n\r\n~~~ html\r\n<script src=\"xregexp.js\"></script>\r\n<script src=\"addons/unicode/unicode-base.js\"></script>\r\n~~~\r\n\r\nThen you can do this:\r\n\r\n~~~ js\r\nvar unicodeWord = XRegExp('^\\\\p{L}+$');\r\nunicodeWord.test('Русский'); // -> true\r\nunicodeWord.test('日本語'); // -> true\r\nunicodeWord.test('العربية'); // -> true\r\n~~~\r\n\r\nThe base script adds `\\p{Letter}` and its alias `\\p{L}`, but other Unicode categories, scripts, blocks, and properties require addon packages. Try these next examples after additionally including `unicode-scripts.js`:\r\n\r\n~~~ js\r\nXRegExp('^\\\\p{Hiragana}+$').test('ひらがな'); // -> true\r\nXRegExp('^[\\\\p{Latin}\\\\p{Common}]+$').test('Über Café.'); // -> true\r\n~~~\r\n\r\nXRegExp uses the Unicode 6.1 Basic Multilingual Plane.\r\n\r\n\r\n### XRegExp.build\r\n\r\nIn browsers, first include the script:\r\n\r\n~~~ html\r\n<script src=\"xregexp.js\"></script>\r\n<script src=\"addons/build.js\"></script>\r\n~~~\r\n\r\nYou can then build regular expressions using named subpatterns, for readability and pattern reuse:\r\n\r\n~~~ js\r\nvar time = XRegExp.build('(?x)^ {{hours}} ({{minutes}}) $', {\r\n hours: XRegExp.build('{{h12}} : | {{h24}}', {\r\n h12: /1[0-2]|0?[1-9]/,\r\n h24: /2[0-3]|[01][0-9]/\r\n }, 'x'),\r\n minutes: /^[0-5][0-9]$/\r\n});\r\n\r\ntime.test('10:59'); // -> true\r\nXRegExp.exec('10:59', time).minutes; // -> '59'\r\n~~~\r\n\r\nNamed subpatterns can be provided as strings or regex objects. A leading `^` and trailing unescaped `$` are stripped from subpatterns if both are present, which allows embedding independently useful anchored patterns. `{{…}}` tokens can be quantified as a single unit. Backreferences in the outer pattern and provided subpatterns are automatically renumbered to work correctly within the larger combined pattern. The syntax `({{name}})` works as shorthand for named capture via `(?<name>{{name}})`. Named subpatterns cannot be embedded within character classes.\r\n\r\nSee also: *[Creating Grammatical Regexes Using XRegExp.build](http://blog.stevenlevithan.com/archives/grammatical-patterns-xregexp-build)*.\r\n\r\n\r\n### XRegExp.matchRecursive\r\n\r\nIn browsers, first include the script:\r\n\r\n~~~ html\r\n<script src=\"xregexp.js\"></script>\r\n<script src=\"addons/matchrecursive.js\"></script>\r\n~~~\r\n\r\nYou can then match recursive constructs using XRegExp pattern strings as left and right delimiters:\r\n\r\n~~~ js\r\nvar str = '(t((e))s)t()(ing)';\r\nXRegExp.matchRecursive(str, '\\\\(', '\\\\)', 'g');\r\n// -> ['t((e))s', '', 'ing']\r\n\r\n// Extended information mode with valueNames\r\nstr = 'Here is <div> <div>an</div></div> example';\r\nXRegExp.matchRecursive(str, '<div\\\\s*>', '</div>', 'gi', {\r\n valueNames: ['between', 'left', 'match', 'right']\r\n});\r\n/* -> [\r\n{name: 'between', value: 'Here is ', start: 0, end: 8},\r\n{name: 'left', value: '<div>', start: 8, end: 13},\r\n{name: 'match', value: ' <div>an</div>', start: 13, end: 27},\r\n{name: 'right', value: '</div>', start: 27, end: 33},\r\n{name: 'between', value: ' example', start: 33, end: 41}\r\n] */\r\n\r\n// Omitting unneeded parts with null valueNames, and using escapeChar\r\nstr = '...{1}\\\\{{function(x,y){return y+x;}}';\r\nXRegExp.matchRecursive(str, '{', '}', 'g', {\r\n valueNames: ['literal', null, 'value', null],\r\n escapeChar: '\\\\'\r\n});\r\n/* -> [\r\n{name: 'literal', value: '...', start: 0, end: 3},\r\n{name: 'value', value: '1', start: 4, end: 5},\r\n{name: 'literal', value: '\\\\{', start: 6, end: 8},\r\n{name: 'value', value: 'function(x,y){return y+x;}', start: 9, end: 35}\r\n] */\r\n\r\n// Sticky mode via flag y\r\nstr = '<1><<<2>>><3>4<5>';\r\nXRegExp.matchRecursive(str, '<', '>', 'gy');\r\n// -> ['1', '<<2>>', '3']\r\n~~~\r\n\r\n`XRegExp.matchRecursive` throws an error if it sees an unbalanced delimiter in the target string.\r\n\r\n\r\n### XRegExp Prototype Methods\r\n\r\nIn browsers, first include the script:\r\n\r\n~~~ html\r\n<script src=\"xregexp.js\"></script>\r\n<script src=\"addons/prototypes.js\"></script>\r\n~~~\r\n\r\nNew XRegExp regexes then gain a collection of useful methods: `apply`, `call`, `forEach`, `globalize`, `xexec`, and `xtest`.\r\n\r\n~~~ js\r\n// To demonstrate the call method, let's first create the function we'll be using...\r\nfunction filter(array, fn) {\r\n var res = [];\r\n array.forEach(function (el) {if (fn.call(null, el)) res.push(el);});\r\n return res;\r\n}\r\n// Now we can filter arrays using functions and regexes\r\nfilter(['a', 'ba', 'ab', 'b'], XRegExp('^a')); // -> ['a', 'ab']\r\n~~~\r\n\r\nNative `RegExp` objects copied by `XRegExp` are augmented with any `XRegExp.prototype` methods. The following lines therefore work equivalently:\r\n\r\n~~~ js\r\nXRegExp('[a-z]', 'ig').xexec('abc');\r\nXRegExp(/[a-z]/ig).xexec('abc');\r\nXRegExp.globalize(/[a-z]/i).xexec('abc');\r\n~~~\r\n\r\n\r\n## Installation and usage\r\n\r\nIn browsers:\r\n\r\n~~~ html\r\n<script src=\"xregexp-min.js\"></script>\r\n~~~\r\n\r\nOr, to bundle XRegExp with all of its addons:\r\n\r\n~~~ html\r\n<script src=\"xregexp-all-min.js\"></script>\r\n~~~\r\n\r\nUsing [npm](http://npmjs.org/):\r\n\r\n~~~ bash\r\nnpm install xregexp\r\n~~~\r\n\r\nIn [Node.js](http://nodejs.org/) and [CommonJS module](http://wiki.commonjs.org/wiki/Modules) loaders:\r\n\r\n~~~ js\r\nvar XRegExp = require('xregexp').XRegExp;\r\n~~~\r\n\r\n\r\n### Running tests on the server with npm\r\n\r\n~~~ bash\r\nnpm install -g qunit # needed to run the tests\r\nnpm test # in the xregexp root\r\n~~~\r\n\r\nIf XRegExp was not installed using npm, just open `tests/index.html` in your browser.\r\n\r\n\r\n## &c\r\n\r\n**Lookbehind:** A [collection of short functions](https://gist.github.com/2387872) is available that makes it easy to simulate infinite-length leading lookbehind.\r\n\r\n\r\n## Changelog\r\n\r\n* Releases: [Version history](http://xregexp.com/history/).\r\n* Upcoming: [Milestones](https://github.com/slevithan/XRegExp/issues/milestones), [Roadmap](https://github.com/slevithan/XRegExp/wiki/Roadmap).\r\n\r\n\r\n## About\r\n\r\nXRegExp and addons copyright 2007-2012 by [Steven Levithan](http://stevenlevithan.com/).\r\n\r\nTools: Unicode range generators by [Mathias Bynens](http://mathiasbynens.be/). Source file concatenator by [Bjarke Walling](http://twitter.com/walling).\r\n\r\nPrior art: `XRegExp.build` inspired by [Lea Verou](http://lea.verou.me/)'s [RegExp.create](http://lea.verou.me/2011/03/create-complex-regexps-more-easily/). `XRegExp.union` inspired by [Ruby](http://www.ruby-lang.org/). XRegExp's syntax extensions come from Perl, .NET, etc.\r\n\r\nAll code released under the [MIT License](http://mit-license.org/).\r\n\r\nFork me to show support, fix, and extend.\r\n\r\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/slevithan/XRegExp.git"
},
"scripts": {
"test": "node tests/node-qunit.js"
},
"version": "2.0.0"
}