-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
115 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
{ | ||
"root": true, | ||
"root": true, | ||
|
||
"extends": "@ljharb", | ||
"extends": "@ljharb", | ||
|
||
"rules": { | ||
"array-bracket-newline": 0, | ||
"array-bracket-spacing": 1, | ||
"indent": [2, 4], | ||
}, | ||
"rules": { | ||
"array-bracket-newline": 0, | ||
}, | ||
|
||
"overrides": [ | ||
{ | ||
"files": "example/**", | ||
"rules": { | ||
"no-console": 0, | ||
}, | ||
}, | ||
], | ||
"overrides": [ | ||
{ | ||
"files": "example/**", | ||
"rules": { | ||
"no-console": 0, | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
'use strict'; | ||
|
||
var concatMap = require('../'); | ||
var xs = [ 1, 2, 3, 4, 5, 6 ]; | ||
var xs = [1, 2, 3, 4, 5, 6]; | ||
var ys = concatMap(xs, function (x) { | ||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; | ||
return x % 2 ? [x - 0.1, x, x + 0.1] : []; | ||
}); | ||
console.dir(ys); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
'use strict'; | ||
|
||
var isArray = Array.isArray || function (xs) { | ||
return Object.prototype.toString.call(xs) === '[object Array]'; | ||
return Object.prototype.toString.call(xs) === '[object Array]'; | ||
}; | ||
|
||
module.exports = function (xs, fn) { | ||
var res = []; | ||
for (var i = 0; i < xs.length; i++) { | ||
var x = fn(xs[i], i); | ||
if (isArray(x)) { | ||
res.push.apply(res, x); | ||
} else { | ||
res.push(x); | ||
} | ||
} | ||
return res; | ||
var res = []; | ||
for (var i = 0; i < xs.length; i++) { | ||
var x = fn(xs[i], i); | ||
if (isArray(x)) { | ||
res.push.apply(res, x); | ||
} else { | ||
res.push(x); | ||
} | ||
} | ||
return res; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
{ | ||
"name": "concat-map", | ||
"description": "concatenative mapdashery", | ||
"version": "0.0.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/substack/node-concat-map.git" | ||
}, | ||
"main": "index.js", | ||
"keywords": [ | ||
"concat", | ||
"concatMap", | ||
"map", | ||
"functional", | ||
"higher-order" | ||
], | ||
"directories": { | ||
"example": "example", | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"lint": "eslint --ext=js,mjs .", | ||
"pretest": "npm run lint", | ||
"tests-only": "tape 'test/**/*.js'", | ||
"test": "npm run tests-only", | ||
"posttest": "aud --production" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^21.0.0", | ||
"aud": "^2.0.1", | ||
"eslint": "=8.8.0", | ||
"tape": "^5.6.1" | ||
}, | ||
"license": "MIT", | ||
"author": { | ||
"name": "James Halliday", | ||
"email": "mail@substack.net", | ||
"url": "http://substack.net" | ||
}, | ||
"testling": { | ||
"files": "test/*.js", | ||
"browsers": { | ||
"ie": [ | ||
6, | ||
7, | ||
8, | ||
9 | ||
], | ||
"ff": [ | ||
3.5, | ||
10, | ||
15 | ||
], | ||
"chrome": [ | ||
10, | ||
22 | ||
], | ||
"safari": [ | ||
5.1 | ||
], | ||
"opera": [ | ||
12 | ||
] | ||
} | ||
} | ||
"name": "concat-map", | ||
"description": "concatenative mapdashery", | ||
"version": "0.0.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/substack/node-concat-map.git" | ||
}, | ||
"main": "index.js", | ||
"keywords": [ | ||
"concat", | ||
"concatMap", | ||
"map", | ||
"functional", | ||
"higher-order" | ||
], | ||
"directories": { | ||
"example": "example", | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"lint": "eslint --ext=js,mjs .", | ||
"pretest": "npm run lint", | ||
"tests-only": "tape 'test/**/*.js'", | ||
"test": "npm run tests-only", | ||
"posttest": "aud --production" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^21.0.0", | ||
"aud": "^2.0.1", | ||
"eslint": "=8.8.0", | ||
"tape": "^5.6.1" | ||
}, | ||
"license": "MIT", | ||
"author": { | ||
"name": "James Halliday", | ||
"email": "mail@substack.net", | ||
"url": "http://substack.net" | ||
}, | ||
"testling": { | ||
"files": "test/*.js", | ||
"browsers": { | ||
"ie": [ | ||
6, | ||
7, | ||
8, | ||
9 | ||
], | ||
"ff": [ | ||
3.5, | ||
10, | ||
15 | ||
], | ||
"chrome": [ | ||
10, | ||
22 | ||
], | ||
"safari": [ | ||
5.1 | ||
], | ||
"opera": [ | ||
12 | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters