Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor #24

Merged
merged 13 commits into from
Apr 8, 2019
16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
sudo: false
os:
- linux
- osx
language: node_js
node_js:
- node
- '9'
- '10'
- '8'
- '7'
- '6'
- '5'
- '4'
- '0.12'
- '0.10'
os:
- linux
- osx
- windows
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# braces [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/braces.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/braces)
# braces [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces)

> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.

Expand All @@ -9,7 +9,7 @@ Please consider following this project's author, [Jon Schlinkert](https://github
Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save braces
$ npm install braces
```

## Why use braces?
Expand Down Expand Up @@ -637,4 +637,4 @@ _This file was generated by [verb-generate-readme](https://github.com/verbose/ve

</li>
</ol>
</section>
</section>
27 changes: 0 additions & 27 deletions appveyor.yml

This file was deleted.

71 changes: 71 additions & 0 deletions bench/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use strict';

const { Suite } = require('benchmark');
const colors = require('ansi-colors');
const argv = require('minimist')(process.argv.slice(2));
const minimatch = require('minimatch');
const braces = require('..');

/**
* Setup
*/

const cycle = (e, newline) => {
process.stdout.write(`\u001b[G ${e.target}${newline ? `\n` : ''}`);
};

const bench = (name, options) => {
const config = { name, ...options };
const suite = new Suite(config);
const add = suite.add.bind(suite);
suite.on('error', console.error);

if (argv.run && !new RegExp(argv.run).test(name)) {
suite.add = () => suite;
return suite;
}

console.log(colors.green(`● ${config.name}`));

suite.add = (key, fn, opts) => {
if (typeof fn !== 'function') opts = fn;

add(key, {
onCycle: e => cycle(e),
onComplete: e => cycle(e, true),
fn,
...opts
});
return suite;
};

return suite;
};

const skip = () => {};
skip.add = () => skip;
skip.run = () => skip;
bench.skip = name => {
console.log(colors.cyan('● ' + colors.unstyle(name) + ' (skipped)'));
return skip;
};

bench('expand - set')
.add(' braces', () => braces.compile('foo/{a,b,c}/bar'))
.add('minimatch', () => minimatch.braceExpand('foo/{a,b,c}/bar'))
.run();

bench('expand - range')
.add(' braces', () => braces.compile('foo/{a..z}/bar'))
.add('minimatch', () => minimatch.braceExpand('foo/{a..z}/bar'))
.run();

bench('expand - nested sets')
.add(' braces', () => braces.compile('foo/{a,b,{x,y,z}}/bar'))
.add('minimatch', () => minimatch.braceExpand('foo/{a,b,{x,y,z}}/bar'))
.run();

bench('expand - nested ranges')
.add(' braces', () => braces.compile('foo/{a,b,{1..25}}/bar'))
.add('minimatch', () => minimatch.braceExpand('foo/{a,b,{1..25}}/bar'))
.run();
21 changes: 21 additions & 0 deletions bench/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "picomatch-benchmarks",
"version": "0.0.0",
"private": true,
"main": "index.js",
"dependencies": {
"ansi-colors": "^3.0.3",
"benchmark": "^2.1.4",
"minimatch": "^3.0.4",
"minimist": "^1.2.0"
},
"lintDeps": {
"devDependencies": {
"files": {
"patterns": [
"*.js"
]
}
}
}
}
4 changes: 0 additions & 4 deletions benchmark/code/brace-expansion.js

This file was deleted.

4 changes: 0 additions & 4 deletions benchmark/code/braces.js

This file was deleted.

4 changes: 0 additions & 4 deletions benchmark/code/minimatch.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/combination-nested.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/combination.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/escaped.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/list-basic.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/list-multiple.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/match.multiple.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/match.sequence.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/no-braces.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/sequence-basic.js

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/fixtures/sequence-multiple.js

This file was deleted.

30 changes: 0 additions & 30 deletions benchmark/index.js

This file was deleted.

65 changes: 0 additions & 65 deletions benchmark/last.md

This file was deleted.

20 changes: 0 additions & 20 deletions examples/ast.js

This file was deleted.

13 changes: 0 additions & 13 deletions examples/braces.js

This file was deleted.

7 changes: 0 additions & 7 deletions examples/brackets.js

This file was deleted.

34 changes: 0 additions & 34 deletions examples/comparison.js

This file was deleted.

6 changes: 6 additions & 0 deletions examples/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

const compile = require('../lib/compile');
const parse = require('../lib/parse');
console.log(compile(parse('{a,b,c}')));
console.log(compile(parse('{01..09}')));
4 changes: 0 additions & 4 deletions examples/escape.js

This file was deleted.

Loading