yeet
This commit is contained in:
4
node_modules/array-map/.travis.yml
generated
vendored
Normal file
4
node_modules/array-map/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
18
node_modules/array-map/LICENSE
generated
vendored
Normal file
18
node_modules/array-map/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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 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.
|
5
node_modules/array-map/example/map.js
generated
vendored
Normal file
5
node_modules/array-map/example/map.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var map = require('../');
|
||||
var letters = map([97,98,99], function (c) {
|
||||
return String.fromCharCode(c);
|
||||
});
|
||||
console.log(letters.join(''));
|
11
node_modules/array-map/index.js
generated
vendored
Normal file
11
node_modules/array-map/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
module.exports = function (xs, f) {
|
||||
if (xs.map) return xs.map(f);
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
var x = xs[i];
|
||||
if (hasOwn.call(xs, i)) res.push(f(x, i, xs));
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
46
node_modules/array-map/package.json
generated
vendored
Normal file
46
node_modules/array-map/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "array-map",
|
||||
"version": "0.0.0",
|
||||
"description": "`[].map(f)` for older browsers",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"tape": "~2.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/array-map.git"
|
||||
},
|
||||
"homepage": "https://github.com/substack/array-map",
|
||||
"keywords": [
|
||||
"array",
|
||||
"map",
|
||||
"browser",
|
||||
"es5",
|
||||
"shim",
|
||||
"ie6",
|
||||
"ie7",
|
||||
"ie8"
|
||||
],
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/6..latest",
|
||||
"firefox/3.5","firefox/latest",
|
||||
"chrome/5","chrome/latest",
|
||||
"opera/12..latest", "opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
46
node_modules/array-map/readme.markdown
generated
vendored
Normal file
46
node_modules/array-map/readme.markdown
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# array-map
|
||||
|
||||
`[].map(f)` for older browsers
|
||||
|
||||
[](https://ci.testling.com/substack/array-map)
|
||||
|
||||
[](http://travis-ci.org/substack/array-map)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var map = require('array-map');
|
||||
var letters = map([97,98,99], function (c) {
|
||||
return String.fromCharCode(c);
|
||||
});
|
||||
console.log(letters.join(''));
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
abc
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var map = require('array-map')
|
||||
```
|
||||
|
||||
## var ys = map(xs, f)
|
||||
|
||||
Create a new array `ys` by applying `f(xs[i], i, xs)` to each element in `xs` at
|
||||
index `i`.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install array-map
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
77
node_modules/array-map/test/map.js
generated
vendored
Normal file
77
node_modules/array-map/test/map.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
var map = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('numbers -> letters', function (t) {
|
||||
t.plan(2);
|
||||
var a = map([97,98,99], function (c) {
|
||||
return String.fromCharCode(c);
|
||||
});
|
||||
t.equal(a.join(''), 'abc');
|
||||
|
||||
var b = map(cripple([97,98,99]), function (c) {
|
||||
return String.fromCharCode(c);
|
||||
});
|
||||
t.equal(b.join(''), 'abc');
|
||||
});
|
||||
|
||||
test('elements and indexes', function (t) {
|
||||
t.plan(8);
|
||||
var x = { q: 5 }, y = 3, z = null;
|
||||
|
||||
t.deepEqual(
|
||||
map([x,y,z], function (c, i) { return i }),
|
||||
[ 0, 1, 2 ],
|
||||
'index check'
|
||||
);
|
||||
t.deepEqual(
|
||||
map([x,y,z], function (c, i) { return i }),
|
||||
[ 0, 1, 2 ],
|
||||
'crippled index check'
|
||||
);
|
||||
|
||||
var xs0 = [ x, y, z ];
|
||||
map(xs0, function (c, i, xs) {
|
||||
t.strictEqual(xs, xs0, 'argument[2]');
|
||||
});
|
||||
var xs1 = [ x, y, z ];
|
||||
map(xs1, function (c, i, xs) {
|
||||
t.strictEqual(xs, xs1, 'crippled argument[2]');
|
||||
});
|
||||
});
|
||||
|
||||
test('ignore holes', function (t) {
|
||||
t.plan(2);
|
||||
t.deepEqual(
|
||||
map(new Array(5), function (x) { return x }),
|
||||
[]
|
||||
);
|
||||
t.deepEqual(
|
||||
map(cripple(new Array(5)), function (x) { return x }),
|
||||
[]
|
||||
);
|
||||
});
|
||||
|
||||
test('sparse map', function (t) {
|
||||
t.plan(2);
|
||||
var xs = new Array(5);
|
||||
xs[2] = 'a';
|
||||
xs[4] = 'b';
|
||||
t.equal(
|
||||
map(xs, function (x, i) { return x + i }).join(''),
|
||||
'a2b4'
|
||||
);
|
||||
|
||||
var ys = new Array(5);
|
||||
ys[2] = 'a';
|
||||
ys[4] = 'b';
|
||||
t.equal(
|
||||
map(cripple(xs), function (x, i) { return x + i }).join(''),
|
||||
'a2b4'
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
function cripple (xs) {
|
||||
xs.map = undefined;
|
||||
return xs;
|
||||
}
|
Reference in New Issue
Block a user