forked from github/cordova-android
Bundle updated node modules
This commit is contained in:
committed by
Nikhil Khandelwal
parent
72bbe9fdf0
commit
d6fe1a65eb
+5
-2
@@ -1,2 +1,5 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Makefile
|
||||
example.js
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
|
||||
test:
|
||||
@node_modules/.bin/tape test/*.js
|
||||
|
||||
.PHONY: test
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
# balanced-match
|
||||
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`.
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||
|
||||
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||
[](https://www.npmjs.org/package/balanced-match)
|
||||
@@ -16,6 +16,7 @@ var balanced = require('balanced-match');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||
```
|
||||
|
||||
The matches are:
|
||||
@@ -28,6 +29,7 @@ $ node example.js
|
||||
pre: 'pre',
|
||||
body: 'first',
|
||||
post: 'between{second}post' }
|
||||
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
var balanced = require('./');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
|
||||
+8
@@ -1,5 +1,8 @@
|
||||
module.exports = balanced;
|
||||
function balanced(a, b, str) {
|
||||
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||
|
||||
var r = range(a, b, str);
|
||||
|
||||
return r && {
|
||||
@@ -11,6 +14,11 @@ function balanced(a, b, str) {
|
||||
};
|
||||
}
|
||||
|
||||
function maybeMatch(reg, str) {
|
||||
var m = str.match(reg);
|
||||
return m ? m[0] : null;
|
||||
}
|
||||
|
||||
balanced.range = range;
|
||||
function range(a, b, str) {
|
||||
var begs, beg, left, right, result;
|
||||
|
||||
+34
-30
@@ -1,38 +1,42 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"balanced-match@^0.3.0",
|
||||
"/Users/steveng/repo/cordova/cordova-android/node_modules/brace-expansion"
|
||||
"balanced-match@^0.4.1",
|
||||
"D:\\Cordova\\cordova-android\\node_modules\\brace-expansion"
|
||||
]
|
||||
],
|
||||
"_from": "balanced-match@>=0.3.0 <0.4.0",
|
||||
"_id": "balanced-match@0.3.0",
|
||||
"_from": "balanced-match@>=0.4.1 <0.5.0",
|
||||
"_id": "balanced-match@0.4.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/balanced-match",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_nodeVersion": "6.0.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/balanced-match-0.4.1.tgz_1462129663650_0.39764496590942144"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "julian@juliangruber.com",
|
||||
"name": "juliangruber"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_npmVersion": "3.8.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "balanced-match",
|
||||
"raw": "balanced-match@^0.3.0",
|
||||
"rawSpec": "^0.3.0",
|
||||
"raw": "balanced-match@^0.4.1",
|
||||
"rawSpec": "^0.4.1",
|
||||
"scope": null,
|
||||
"spec": ">=0.3.0 <0.4.0",
|
||||
"spec": ">=0.4.1 <0.5.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz",
|
||||
"_shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756",
|
||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz",
|
||||
"_shasum": "19053e2e0748eadb379da6c09d455cf5e1039335",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "balanced-match@^0.3.0",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/brace-expansion",
|
||||
"_spec": "balanced-match@^0.4.1",
|
||||
"_where": "D:\\Cordova\\cordova-android\\node_modules\\brace-expansion",
|
||||
"author": {
|
||||
"email": "mail@juliangruber.com",
|
||||
"name": "Julian Gruber",
|
||||
@@ -44,28 +48,28 @@
|
||||
"dependencies": {},
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"devDependencies": {
|
||||
"tape": "~4.2.2"
|
||||
"tape": "~4.5.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756",
|
||||
"tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz"
|
||||
"shasum": "19053e2e0748eadb379da6c09d455cf5e1039335",
|
||||
"tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz"
|
||||
},
|
||||
"gitHead": "a7114b0986554787e90b7ac595a043ca75ea77e5",
|
||||
"gitHead": "7004b289baaaab6a832f4901735e29d37cc2a863",
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"keywords": [
|
||||
"balanced",
|
||||
"match",
|
||||
"parse",
|
||||
"regexp",
|
||||
"test"
|
||||
"test",
|
||||
"balanced",
|
||||
"parse"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
"email": "julian@juliangruber.com",
|
||||
"name": "juliangruber"
|
||||
}
|
||||
],
|
||||
"name": "balanced-match",
|
||||
@@ -80,19 +84,19 @@
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"android-browser/4.2..latest",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"ie/8..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest"
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
"version": "0.4.1"
|
||||
}
|
||||
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
var test = require('tape');
|
||||
var balanced = require('..');
|
||||
|
||||
test('balanced', function(t) {
|
||||
t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), {
|
||||
start: 3,
|
||||
end: 12,
|
||||
pre: 'pre',
|
||||
body: 'in{nest}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), {
|
||||
start: 8,
|
||||
end: 11,
|
||||
pre: '{{{{{{{{',
|
||||
body: 'in',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{body{in}post'), {
|
||||
start: 8,
|
||||
end: 11,
|
||||
pre: 'pre{body',
|
||||
body: 'in',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), {
|
||||
start: 4,
|
||||
end: 13,
|
||||
pre: 'pre}',
|
||||
body: 'in{nest}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), {
|
||||
start: 3,
|
||||
end: 8,
|
||||
pre: 'pre',
|
||||
body: 'body',
|
||||
post: 'between{body2}post'
|
||||
});
|
||||
t.notOk(balanced('{', '}', 'nope'), 'should be notOk');
|
||||
t.deepEqual(balanced('<b>', '</b>', 'pre<b>in<b>nest</b></b>post'), {
|
||||
start: 3,
|
||||
end: 19,
|
||||
pre: 'pre',
|
||||
body: 'in<b>nest</b>',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('<b>', '</b>', 'pre</b><b>in<b>nest</b></b>post'), {
|
||||
start: 7,
|
||||
end: 23,
|
||||
pre: 'pre</b>',
|
||||
body: 'in<b>nest</b>',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{{', '}}', 'pre{{{in}}}post'), {
|
||||
start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: '{in}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{{{', '}}', 'pre{{{in}}}post'), {
|
||||
start: 3,
|
||||
end: 8,
|
||||
pre: 'pre',
|
||||
body: 'in',
|
||||
post: '}post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{{first}in{second}post'), {
|
||||
start: 4,
|
||||
end: 10,
|
||||
pre: 'pre{',
|
||||
body: 'first',
|
||||
post: 'in{second}post'
|
||||
});
|
||||
t.deepEqual(balanced('<?', '?>', 'pre<?>post'), {
|
||||
start: 3,
|
||||
end: 4,
|
||||
pre: 'pre',
|
||||
body: '',
|
||||
post: 'post'
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user