Skip to content

Commit

Permalink
Merge pull request #3 from snyamathi/node4
Browse files Browse the repository at this point in the history
Transpile for and test against node 4
  • Loading branch information
snyamathi authored Dec 23, 2017
2 parents facff56 + 5fadebc commit 8186193
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
["env", {
"targets": {
"node": "4"
}
}]
]
}
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
artifacts
/artifacts
/semver-intersect.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.nyc_output
artifacts
node_modules
semver-intersect.js
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
.nyc_output
.travis.yml
artifacts
src
tests
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
language: node_js
node_js:
"node"
- 4
- 6
- 8
- 9
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Get the intersection of multiple semver ranges
const { intersect } = require('semver-intersect');

// ^4.1.0
intersect('^4.0.0', '^4.1.0');
intersect('^4.0.0', '^4.1.0');

// ~4.3.0
intersect('^4.0.0', '~4.3.0');
intersect('^4.0.0', '~4.3.0');

// ~4.3.89
intersect('^4.0.0', '~4.3.89', '~4.3.24', '~4.3.63');
intersect('^4.0.0', '~4.3.89', '~4.3.24', '~4.3.63');

// throws "Range >=4.5.0 is not compatible with <4.4.0"
intersect('^4.0.0', '~4.3.0', '^4.5.0')
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
},
"description": "Get the intersection of multiple semver ranges",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"chai": "^4.0.0",
"eslint": "^4.0.0",
"jenkins-mocha": "^4.0.0"
Expand All @@ -22,8 +25,11 @@
"url": "git@github.com:snyamathi/semver-intersect.git"
},
"scripts": {
"build": "babel src -d .",
"lint": "eslint .",
"test": "jenkins-mocha tests/unit --recursive"
"prepublish": "npm run build",
"pretest": "npm run build",
"test": "jenkins-mocha tests/unit --recursive --compilers js:babel-register"
},
"version": "1.1.2"
}
2 changes: 1 addition & 1 deletion semver-intersect.js → src/semver-intersect.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function parseRange (range) {

function union (a, b) {
return b.reduce((result, value) => {
if (!result.includes(value)) {
if (result.indexOf(value) === -1) {
result.push(value);
}
return result;
Expand Down
1 change: 0 additions & 1 deletion tests/unit/semver-intersect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const expect = require('chai').expect;
const semver = require('semver');
const {
createShorthand,
ensureCompatible,
Expand Down

0 comments on commit 8186193

Please sign in to comment.