added unit testing, and started implementing unit tests...phew
This commit is contained in:
7
node_modules/array-from/License.md
generated
vendored
Normal file
7
node_modules/array-from/License.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright © 2015-2016 Studio B12 GmbH
|
||||
|
||||
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.
|
90
node_modules/array-from/Readme.md
generated
vendored
Normal file
90
node_modules/array-from/Readme.md
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
[](https://coveralls.io/r/studio-b12/array-from
|
||||
) [](https://travis-ci.org/studio-b12/array-from
|
||||
) [](https://david-dm.org/studio-b12/array-from
|
||||
) [](https://github.com/airbnb/javascript)
|
||||
|
||||
|
||||
|
||||
|
||||
array-from
|
||||
==========
|
||||
|
||||
**A ponyfill for the ES 2015 [`Array.from()`][].**
|
||||
|
||||
*** Ponyfill**: A polyfill that doesn't overwrite the native method.
|
||||
*** ES 2015**: The new name for ES6 that [nobody expected][].
|
||||
|
||||
Modeled after the final ES 2015 spec. Credits for the implementation go to the amazing folks of the MDN and the amazing guy [@barberboy](https://github.com/barberboy).
|
||||
|
||||
|
||||
|
||||
[`Array.from()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from "Array.from()"
|
||||
[nobody expected]: http://webreflection.blogspot.de/2015/01/javascript-and-living-ecmascript.html "JavaScript and the living ECMAScript Standard"
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
```sh
|
||||
$ npm install array-from
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Recommended:
|
||||
|
||||
```js
|
||||
var arrayFrom = require('array-from');
|
||||
// You’ll get the native `Array.from` if it’s available.
|
||||
|
||||
function () {console.log(
|
||||
arrayFrom(arguments).map(require('1-liners/increment'))
|
||||
);}(1, 2, 3);
|
||||
//» [2, 3, 4]
|
||||
```
|
||||
|
||||
You can also use it as a classical polyfill. It’s [not recommended][], but sometimes practical:
|
||||
|
||||
```js
|
||||
if (!Array.from) Array.from = require('array-from');
|
||||
// This will affect all loaded modules.
|
||||
|
||||
function () {console.log(
|
||||
Array.from(arguments).map(require('1-liners/increment'))
|
||||
);}(1, 2, 3);
|
||||
//» [2, 3, 4]
|
||||
```
|
||||
|
||||
[not recommended]: https://github.com/sindresorhus/object-assign/issues/10#issuecomment-65065859 "Optionally shim native method?"
|
||||
|
||||
|
||||
|
||||
|
||||
Support note
|
||||
------------
|
||||
|
||||
We support the _current_ and _active LTS_ release of Node.js. More info in [nodejs/LTS](https://github.com/nodejs/LTS#lts_schedule).
|
||||
|
||||
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
[MIT][] © [Studio B12 GmbH][]
|
||||
|
||||
[MIT]: ./License.md
|
||||
[Studio B12 GmbH]: https://github.com/studio-b12
|
4
node_modules/array-from/index.js
generated
vendored
Normal file
4
node_modules/array-from/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = (typeof Array.from === 'function' ?
|
||||
Array.from :
|
||||
require('./polyfill')
|
||||
);
|
86
node_modules/array-from/package.json
generated
vendored
Normal file
86
node_modules/array-from/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"_from": "array-from@^2.1.1",
|
||||
"_id": "array-from@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=",
|
||||
"_location": "/array-from",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-from@^2.1.1",
|
||||
"name": "array-from",
|
||||
"escapedName": "array-from",
|
||||
"rawSpec": "^2.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@sinonjs/samsam"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz",
|
||||
"_shasum": "cfe9d8c26628b9dc5aecc62a9f5d8f1f352c1195",
|
||||
"_spec": "array-from@^2.1.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/@sinonjs/samsam",
|
||||
"bugs": {
|
||||
"url": "https://github.com/studio-b12/array-from/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tomek Wiszniewski",
|
||||
"email": "t.wiszniewski@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Barber",
|
||||
"url": "http://github.com/barberboy"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "A ponyfill for the ES 2015 (ES6) `Array.from()`.",
|
||||
"devDependencies": {
|
||||
"1-liners": "0.2.2",
|
||||
"core-js": "^1.0.0",
|
||||
"coveralls": "2.11.2",
|
||||
"istanbul": "0.3.14",
|
||||
"jshint": "2.7.0",
|
||||
"lodash.isnative": "^3.0.4",
|
||||
"nodangel": "1.3.8",
|
||||
"tap-spec": "2.2.2",
|
||||
"tape": "4.2.2",
|
||||
"tape-catch": "1.0.4"
|
||||
},
|
||||
"files": [
|
||||
"/*.js",
|
||||
"/Readme.md",
|
||||
"/License.md"
|
||||
],
|
||||
"homepage": "https://github.com/studio-b12/array-from#readme",
|
||||
"keywords": [
|
||||
"Array.from",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"convert",
|
||||
"to",
|
||||
"array",
|
||||
"es-2015",
|
||||
"es2015",
|
||||
"es6"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "array-from",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/studio-b12/array-from.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover test.js",
|
||||
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
|
||||
"develop": "nodangel --ignore node_modules --ignore coverage --exec 'npm run --silent test:lite'",
|
||||
"test": "jshint . && npm run test:lite",
|
||||
"test:lite": "node test.js | tap-spec",
|
||||
"view-coverage": "echo 'Generating coverage reports...'; npm run coverage >/dev/null && echo '...done.' && xdg-open ./coverage/lcov-report/index.html >/dev/null"
|
||||
},
|
||||
"version": "2.1.1"
|
||||
}
|
212
node_modules/array-from/polyfill.js
generated
vendored
Normal file
212
node_modules/array-from/polyfill.js
generated
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
// Production steps of ECMA-262, Edition 6, 22.1.2.1
|
||||
// Reference: http://www.ecma-international.org/ecma-262/6.0/#sec-array.from
|
||||
module.exports = (function() {
|
||||
var isCallable = function(fn) {
|
||||
return typeof fn === 'function';
|
||||
};
|
||||
var toInteger = function (value) {
|
||||
var number = Number(value);
|
||||
if (isNaN(number)) { return 0; }
|
||||
if (number === 0 || !isFinite(number)) { return number; }
|
||||
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
|
||||
};
|
||||
var maxSafeInteger = Math.pow(2, 53) - 1;
|
||||
var toLength = function (value) {
|
||||
var len = toInteger(value);
|
||||
return Math.min(Math.max(len, 0), maxSafeInteger);
|
||||
};
|
||||
var iteratorProp = function(value) {
|
||||
if(value != null) {
|
||||
if(['string','number','boolean','symbol'].indexOf(typeof value) > -1){
|
||||
return Symbol.iterator;
|
||||
} else if (
|
||||
(typeof Symbol !== 'undefined') &&
|
||||
('iterator' in Symbol) &&
|
||||
(Symbol.iterator in value)
|
||||
) {
|
||||
return Symbol.iterator;
|
||||
}
|
||||
// Support "@@iterator" placeholder, Gecko 27 to Gecko 35
|
||||
else if ('@@iterator' in value) {
|
||||
return '@@iterator';
|
||||
}
|
||||
}
|
||||
};
|
||||
var getMethod = function(O, P) {
|
||||
// Assert: IsPropertyKey(P) is true.
|
||||
if (O != null && P != null) {
|
||||
// Let func be GetV(O, P).
|
||||
var func = O[P];
|
||||
// ReturnIfAbrupt(func).
|
||||
// If func is either undefined or null, return undefined.
|
||||
if(func == null) {
|
||||
return void 0;
|
||||
}
|
||||
// If IsCallable(func) is false, throw a TypeError exception.
|
||||
if (!isCallable(func)) {
|
||||
throw new TypeError(func + ' is not a function');
|
||||
}
|
||||
return func;
|
||||
}
|
||||
};
|
||||
var iteratorStep = function(iterator) {
|
||||
// Let result be IteratorNext(iterator).
|
||||
// ReturnIfAbrupt(result).
|
||||
var result = iterator.next();
|
||||
// Let done be IteratorComplete(result).
|
||||
// ReturnIfAbrupt(done).
|
||||
var done = Boolean(result.done);
|
||||
// If done is true, return false.
|
||||
if(done) {
|
||||
return false;
|
||||
}
|
||||
// Return result.
|
||||
return result;
|
||||
};
|
||||
|
||||
// The length property of the from method is 1.
|
||||
return function from(items /*, mapFn, thisArg */ ) {
|
||||
'use strict';
|
||||
|
||||
// 1. Let C be the this value.
|
||||
var C = this;
|
||||
|
||||
// 2. If mapfn is undefined, let mapping be false.
|
||||
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
|
||||
|
||||
var T;
|
||||
if (typeof mapFn !== 'undefined') {
|
||||
// 3. else
|
||||
// a. If IsCallable(mapfn) is false, throw a TypeError exception.
|
||||
if (!isCallable(mapFn)) {
|
||||
throw new TypeError(
|
||||
'Array.from: when provided, the second argument must be a function'
|
||||
);
|
||||
}
|
||||
|
||||
// b. If thisArg was supplied, let T be thisArg; else let T
|
||||
// be undefined.
|
||||
if (arguments.length > 2) {
|
||||
T = arguments[2];
|
||||
}
|
||||
// c. Let mapping be true (implied by mapFn)
|
||||
}
|
||||
|
||||
var A, k;
|
||||
|
||||
// 4. Let usingIterator be GetMethod(items, @@iterator).
|
||||
// 5. ReturnIfAbrupt(usingIterator).
|
||||
var usingIterator = getMethod(items, iteratorProp(items));
|
||||
|
||||
// 6. If usingIterator is not undefined, then
|
||||
if (usingIterator !== void 0) {
|
||||
// a. If IsConstructor(C) is true, then
|
||||
// i. Let A be the result of calling the [[Construct]]
|
||||
// internal method of C with an empty argument list.
|
||||
// b. Else,
|
||||
// i. Let A be the result of the abstract operation ArrayCreate
|
||||
// with argument 0.
|
||||
// c. ReturnIfAbrupt(A).
|
||||
A = isCallable(C) ? Object(new C()) : [];
|
||||
|
||||
// d. Let iterator be GetIterator(items, usingIterator).
|
||||
var iterator = usingIterator.call(items);
|
||||
|
||||
// e. ReturnIfAbrupt(iterator).
|
||||
if (iterator == null) {
|
||||
throw new TypeError(
|
||||
'Array.from requires an array-like or iterable object'
|
||||
);
|
||||
}
|
||||
|
||||
// f. Let k be 0.
|
||||
k = 0;
|
||||
|
||||
// g. Repeat
|
||||
var next, nextValue;
|
||||
while (true) {
|
||||
// i. Let Pk be ToString(k).
|
||||
// ii. Let next be IteratorStep(iterator).
|
||||
// iii. ReturnIfAbrupt(next).
|
||||
next = iteratorStep(iterator);
|
||||
|
||||
// iv. If next is false, then
|
||||
if (!next) {
|
||||
|
||||
// 1. Let setStatus be Set(A, "length", k, true).
|
||||
// 2. ReturnIfAbrupt(setStatus).
|
||||
A.length = k;
|
||||
|
||||
// 3. Return A.
|
||||
return A;
|
||||
}
|
||||
// v. Let nextValue be IteratorValue(next).
|
||||
// vi. ReturnIfAbrupt(nextValue)
|
||||
nextValue = next.value;
|
||||
|
||||
// vii. If mapping is true, then
|
||||
// 1. Let mappedValue be Call(mapfn, T, «nextValue, k»).
|
||||
// 2. If mappedValue is an abrupt completion, return
|
||||
// IteratorClose(iterator, mappedValue).
|
||||
// 3. Let mappedValue be mappedValue.[[value]].
|
||||
// viii. Else, let mappedValue be nextValue.
|
||||
// ix. Let defineStatus be the result of
|
||||
// CreateDataPropertyOrThrow(A, Pk, mappedValue).
|
||||
// x. [TODO] If defineStatus is an abrupt completion, return
|
||||
// IteratorClose(iterator, defineStatus).
|
||||
if (mapFn) {
|
||||
A[k] = mapFn.call(T, nextValue, k);
|
||||
}
|
||||
else {
|
||||
A[k] = nextValue;
|
||||
}
|
||||
// xi. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
// 7. Assert: items is not an Iterable so assume it is
|
||||
// an array-like object.
|
||||
} else {
|
||||
|
||||
// 8. Let arrayLike be ToObject(items).
|
||||
var arrayLike = Object(items);
|
||||
|
||||
// 9. ReturnIfAbrupt(items).
|
||||
if (items == null) {
|
||||
throw new TypeError(
|
||||
'Array.from requires an array-like object - not null or undefined'
|
||||
);
|
||||
}
|
||||
|
||||
// 10. Let len be ToLength(Get(arrayLike, "length")).
|
||||
// 11. ReturnIfAbrupt(len).
|
||||
var len = toLength(arrayLike.length);
|
||||
|
||||
// 12. If IsConstructor(C) is true, then
|
||||
// a. Let A be Construct(C, «len»).
|
||||
// 13. Else
|
||||
// a. Let A be ArrayCreate(len).
|
||||
// 14. ReturnIfAbrupt(A).
|
||||
A = isCallable(C) ? Object(new C(len)) : new Array(len);
|
||||
|
||||
// 15. Let k be 0.
|
||||
k = 0;
|
||||
// 16. Repeat, while k < len… (also steps a - h)
|
||||
var kValue;
|
||||
while (k < len) {
|
||||
kValue = arrayLike[k];
|
||||
if (mapFn) {
|
||||
A[k] = mapFn.call(T, kValue, k);
|
||||
}
|
||||
else {
|
||||
A[k] = kValue;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
// 17. Let setStatus be Set(A, "length", len, true).
|
||||
// 18. ReturnIfAbrupt(setStatus).
|
||||
A.length = len;
|
||||
// 19. Return A.
|
||||
}
|
||||
return A;
|
||||
};
|
||||
})();
|
275
node_modules/array-from/test.js
generated
vendored
Normal file
275
node_modules/array-from/test.js
generated
vendored
Normal file
@ -0,0 +1,275 @@
|
||||
var test = require('tape-catch');
|
||||
var plus = require('1-liners/plus');
|
||||
var isNative = require('lodash.isnative');
|
||||
// Shim Symbol.iterator if it's not available
|
||||
require('core-js/es6/symbol');
|
||||
|
||||
var arrayFrom = require('./polyfill');
|
||||
|
||||
test('Works as expected', function(is) {
|
||||
var mock = {
|
||||
0: 'a',
|
||||
1: 'b',
|
||||
2: 'c',
|
||||
length: 3,
|
||||
};
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(mock),
|
||||
['a', 'b', 'c'],
|
||||
'with a mock object'
|
||||
);
|
||||
|
||||
is.ok(
|
||||
arrayFrom(mock) instanceof Array,
|
||||
'– returning an array'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom({
|
||||
0: 'a',
|
||||
1: 'b',
|
||||
2: 'c',
|
||||
'a': 'left out',
|
||||
'-1': 'left out',
|
||||
length: 3,
|
||||
}),
|
||||
['a', 'b', 'c'],
|
||||
'– ignoring illegal indices'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom({}),
|
||||
[],
|
||||
'with an empty object'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom([]),
|
||||
[],
|
||||
'with an empty array'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
(function() {return arrayFrom(arguments);})('a', 'b', 'c'),
|
||||
['a', 'b', 'c'],
|
||||
'with the `arguments` object'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(['a', 'b', 'c']),
|
||||
['a', 'b', 'c'],
|
||||
'with an array'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(mock, plus),
|
||||
['a0', 'b1', 'c2'],
|
||||
'when dealing with `mapFn`'
|
||||
);
|
||||
|
||||
var context = {suffix: '+'};
|
||||
is.deepEqual(
|
||||
arrayFrom(mock,
|
||||
function(item) {return (item + this.suffix);},
|
||||
context
|
||||
),
|
||||
['a+', 'b+', 'c+'],
|
||||
'when dealing with `mapFn` and `thisArg`'
|
||||
);
|
||||
|
||||
var Transferable = function(){};
|
||||
Transferable.from = arrayFrom;
|
||||
|
||||
is.ok(
|
||||
Transferable.from([1]) instanceof Transferable,
|
||||
'can be transferred to other constructor functions'
|
||||
);
|
||||
|
||||
is.end();
|
||||
});
|
||||
|
||||
test('Works for iterable objects', function(is) {
|
||||
|
||||
var SetPolyfill = require('core-js/library/fn/set');
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(new SetPolyfill(['a', 'b', 'c'])),
|
||||
['a', 'b', 'c'],
|
||||
'with Set (polyfill)'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(new SetPolyfill(['a', 'b', 'c']).values(), plus),
|
||||
['a0', 'b1', 'c2'],
|
||||
'when dealing with `mapFn`'
|
||||
);
|
||||
|
||||
var context = {suffix: '+'};
|
||||
is.deepEqual(
|
||||
arrayFrom(new SetPolyfill(['a', 'b', 'c']).keys(),
|
||||
function(item) {return (item + this.suffix);},
|
||||
context
|
||||
),
|
||||
['a+', 'b+', 'c+'],
|
||||
'when dealing with `mapFn` and `thisArg`'
|
||||
);
|
||||
|
||||
if(typeof Set !== 'undefined' && isNative(Set)) {
|
||||
is.deepEqual(
|
||||
arrayFrom(new Set(['a', 'b', 'c'])),
|
||||
['a', 'b', 'c'],
|
||||
'with native Set'
|
||||
);
|
||||
}
|
||||
|
||||
if(typeof Map !== 'undefined' && isNative(Map)) {
|
||||
is.deepEqual(
|
||||
arrayFrom(new Map()
|
||||
.set('key1', 'value1')
|
||||
.set('key2', 'value2')
|
||||
.set('key3', 'value3')
|
||||
.keys()
|
||||
),
|
||||
['key1', 'key2', 'key3'],
|
||||
'with native Map'
|
||||
);
|
||||
}
|
||||
|
||||
var geckoIterator = {
|
||||
value : 1,
|
||||
'@@iterator' : function(){
|
||||
var hasValue = true;
|
||||
var value = this.value;
|
||||
return {
|
||||
next: function(){
|
||||
if(hasValue) {
|
||||
hasValue = false;
|
||||
return { value: value, done: false };
|
||||
} else {
|
||||
return { done: true };
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(geckoIterator),
|
||||
[1],
|
||||
'when using Gecko-based "@@iterator" property.'
|
||||
);
|
||||
|
||||
geckoIterator['@@iterator'] = null;
|
||||
is.deepEqual(
|
||||
arrayFrom(geckoIterator),
|
||||
[],
|
||||
'null iterator is like no iterator');
|
||||
|
||||
var Transferable = function(){};
|
||||
Transferable.from = arrayFrom;
|
||||
|
||||
is.ok(Transferable.from(new SetPolyfill(['a'])) instanceof Transferable,
|
||||
'can be transferred to other constructor functions (iterable)'
|
||||
);
|
||||
|
||||
is.end();
|
||||
});
|
||||
|
||||
test('Throws when things go very wrong.', function(is) {
|
||||
is.throws(
|
||||
function() {
|
||||
arrayFrom();
|
||||
},
|
||||
TypeError,
|
||||
'when the given object is invalid'
|
||||
);
|
||||
|
||||
is.throws(
|
||||
function() {
|
||||
arrayFrom({length: 0}, /invalid/);
|
||||
},
|
||||
TypeError,
|
||||
'when `mapFn` is invalid'
|
||||
);
|
||||
|
||||
var invalidIterator = {};
|
||||
invalidIterator[Symbol.iterator] = {};
|
||||
|
||||
is.throws(
|
||||
function() {
|
||||
arrayFrom(invalidIterator);
|
||||
},
|
||||
TypeError,
|
||||
'when an iterable has an invalid iterator property'
|
||||
);
|
||||
|
||||
var noIterator = {};
|
||||
noIterator[Symbol.iterator] = function(){};
|
||||
|
||||
is.throws(
|
||||
function() {
|
||||
arrayFrom(noIterator);
|
||||
},
|
||||
TypeError,
|
||||
'– no iterator returned');
|
||||
|
||||
var noNext = {};
|
||||
noNext[Symbol.iterator] = function(){ return {}; };
|
||||
|
||||
is.throws(
|
||||
function() {
|
||||
arrayFrom(noNext);
|
||||
},
|
||||
TypeError,
|
||||
'– no `next` function'
|
||||
);
|
||||
|
||||
is.end();
|
||||
});
|
||||
|
||||
test('Works for non-objects', function(is) {
|
||||
is.deepEqual(
|
||||
arrayFrom('a'),
|
||||
['a'],
|
||||
'string'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom('👺'),
|
||||
['👺'],
|
||||
'string(emoji)'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom('abc'),
|
||||
['a', 'b', 'c'],
|
||||
'string'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom('👺🍣🍻'),
|
||||
['👺', '🍣', '🍻'],
|
||||
'string(emoji)'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(true),
|
||||
[],
|
||||
'boolean'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(1),
|
||||
[],
|
||||
'number'
|
||||
);
|
||||
|
||||
is.deepEqual(
|
||||
arrayFrom(Symbol()),
|
||||
[],
|
||||
'symbol'
|
||||
);
|
||||
|
||||
is.end();
|
||||
});
|
Reference in New Issue
Block a user