Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
305 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"root": true, | ||
|
||
"extends": "@ljharb", | ||
|
||
"rules": { | ||
"max-statements-per-line": [2, { "max": 2 }], | ||
"max-statements": [2, 16], | ||
"new-cap": [2, { | ||
"capIsNewExceptions": [ | ||
"CreateDataPropertyOrThrow", | ||
"Get", | ||
"GetIterator", | ||
"IteratorStep", | ||
"IteratorClose", | ||
"IteratorValue", | ||
"ThrowCompletion", | ||
"ToPropertyKey", | ||
"Type", | ||
], | ||
}], | ||
}, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,203 @@ | ||
language: node_js | ||
os: | ||
- linux | ||
node_js: | ||
- "9.8" | ||
- "8.10" | ||
- "7.10" | ||
- "6.13" | ||
- "5.12" | ||
- "4.8" | ||
- "iojs-v3.3" | ||
- "iojs-v2.5" | ||
- "iojs-v1.8" | ||
- "0.12" | ||
- "0.10" | ||
- "0.8" | ||
before_install: | ||
- 'nvm install-latest-npm' | ||
install: | ||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' | ||
script: | ||
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' | ||
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' | ||
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' | ||
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' | ||
sudo: false | ||
env: | ||
- TEST=true | ||
matrix: | ||
fast_finish: true | ||
include: | ||
- node_js: "lts/*" | ||
env: PRETEST=true | ||
- node_js: "lts/*" | ||
env: POSTTEST=true | ||
- node_js: "4" | ||
env: COVERAGE=true | ||
- node_js: "9.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "9.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.9" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.8" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "8.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.9" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.8" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "7.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.12" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.11" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.10" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.9" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.8" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "6.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.11" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.10" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.9" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.8" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "5.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "4.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v3.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v3.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v3.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v2.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v2.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v2.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v2.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v2.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.7" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.5" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.3" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.2" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.1" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "iojs-v1.0" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "0.11" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "0.9" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "0.6" | ||
env: TEST=true ALLOW_FAILURE=true | ||
- node_js: "0.4" | ||
env: TEST=true ALLOW_FAILURE=true | ||
allow_failures: | ||
- os: osx | ||
- env: TEST=true ALLOW_FAILURE=true | ||
- env: COVERAGE=true |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"rules": { | ||
"array-bracket-newline": 0, | ||
"array-element-newline": 0, | ||
"max-nested-callbacks": [2, 3], | ||
"max-statements": [2, 12], | ||
"max-statements-per-line": [2, { "max": 3 }], | ||
"no-invalid-this": 1, | ||
"object-curly-newline": 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
var fromEntries = require('../'); | ||
var test = require('tape'); | ||
var runTests = require('./tests'); | ||
|
||
test('as a function', function (t) { | ||
t.test('bad array/this value', function (st) { | ||
st['throws'](function () { fromEntries(undefined); }, TypeError, 'undefined is not an object'); | ||
st['throws'](function () { fromEntries(null); }, TypeError, 'null is not an object'); | ||
st.end(); | ||
}); | ||
|
||
runTests(fromEntries, t); | ||
|
||
t.end(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
var fromEntries = require('../'); | ||
fromEntries.shim(); | ||
|
||
var test = require('tape'); | ||
var defineProperties = require('define-properties'); | ||
var isEnumerable = Object.prototype.propertyIsEnumerable; | ||
var functionsHaveNames = function f() {}.name === 'f'; | ||
|
||
var runTests = require('./tests'); | ||
|
||
test('shimmed', function (t) { | ||
t.equal(Object.fromEntries.length, 1, 'Object.fromEntries has a length of 1'); | ||
t.test('Function name', { skip: !functionsHaveNames }, function (st) { | ||
st.equal(Object.fromEntries.name, 'fromEntries', 'Object.fromEntries has name "fromEntries"'); | ||
st.end(); | ||
}); | ||
|
||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { | ||
et.equal(false, isEnumerable.call(Object, 'fromEntries'), 'Object.fromEntries is not enumerable'); | ||
et.end(); | ||
}); | ||
|
||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); | ||
|
||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) { | ||
st['throws'](function () { return Object.fromEntries(undefined); }, TypeError, 'undefined is not an object'); | ||
st['throws'](function () { return Object.fromEntries(null); }, TypeError, 'null is not an object'); | ||
st.end(); | ||
}); | ||
|
||
runTests(Object.fromEntries, t); | ||
|
||
t.end(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
/* global Symbol */ | ||
|
||
// var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; | ||
|
||
module.exports = function (fromEntries, t) { | ||
var a = {}; | ||
var b = {}; | ||
var c = {}; | ||
var entries = [['a', a], ['b', b], ['c', c]]; | ||
var obj = { a: a, b: b, c: c }; | ||
|
||
t.deepEqual(fromEntries(entries), obj, 'entries -> obj'); | ||
}; |