Skip to content

Commit

Permalink
Require Node.js 4
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 24, 2017
1 parent 138c00d commit f1e3f7c
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 91 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
*.js text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
13 changes: 0 additions & 13 deletions .jshintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
sudo: false
language: node_js
node_js:
- 'iojs'
- '0.12'
- '0.10'
- '8'
- '6'
- '4'
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
'use strict';
module.exports = function () {
return /\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/ig;
};
module.exports = () => (/\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/ig);
20 changes: 4 additions & 16 deletions license
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)

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.
67 changes: 34 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
{
"name": "semver-regex",
"version": "1.0.0",
"description": "Regular expression for matching semver versions",
"license": "MIT",
"repository": "sindresorhus/semver-regex",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "http:https://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"semver",
"version",
"versions",
"regex",
"regexp",
"re",
"match",
"matching",
"semantic"
],
"devDependencies": {
"mocha": "*"
}
"name": "semver-regex",
"version": "1.0.0",
"description": "Regular expression for matching semver versions",
"license": "MIT",
"repository": "sindresorhus/semver-regex",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"semver",
"version",
"versions",
"regex",
"regexp",
"re",
"match",
"matching",
"semantic"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Install

```
$ npm install --save semver-regex
$ npm install semver-regex
```


Expand Down
33 changes: 16 additions & 17 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
var assert = require('assert');
var semverRegex = require('./');
import test from 'ava';
import m from '.';

var fixture = [
const fixture = [
'0.0.0',
'0.10.0',
'v1.0.0',
Expand All @@ -16,23 +15,23 @@ var fixture = [
'foo 0.0.0 bar 0.0.0'
];

it('should match semver versions on test', function () {
fixture.forEach(function (el) {
assert(semverRegex().test(el), el);
});
test('matches semver versions on test', t => {
for (const el of fixture) {
t.regex(el, m());
}

assert(!semverRegex().test('0.88'));
assert(!semverRegex().test('1.0.08'));
assert(!semverRegex().test('1.08.0'));
assert(!semverRegex().test('01.8.0'));
t.notRegex('0.88', m());
t.notRegex('1.0.08', m());
t.notRegex('1.08.0', m());
t.notRegex('01.8.0', m());
});

it('should return semver on match', function () {
assert.deepEqual('0.0.0'.match(semverRegex()), ['0.0.0']);
assert.deepEqual('foo 0.0.0 bar 0.1.1'.match(semverRegex()), ['0.0.0', '0.1.1']);
test('returns semver on match', t => {
t.deepEqual('0.0.0'.match(m()), ['0.0.0']);
t.deepEqual('foo 0.0.0 bar 0.1.1'.match(m()), ['0.0.0', '0.1.1']);
});

// See: https://github.com/sindresorhus/semver-regex/issues/7
it.skip('should not return tag prefix', function () {
assert.deepEqual('v0.0.0'.match(semverRegex()), ['0.0.0'])
test.failing('doesn not return tag prefix', t => {
t.deepEqual('v0.0.0'.match(m()), ['0.0.0']);
});

0 comments on commit f1e3f7c

Please sign in to comment.