-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
25 changed files
with
143 additions
and
15 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
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
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
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
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
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
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
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
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
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
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
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
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,3 @@ | ||
'use strict'; | ||
|
||
require('./shim')(); |
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,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('iterator.prototype'); |
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,12 @@ | ||
'use strict'; | ||
|
||
var implementation = require('./implementation'); | ||
var getPolyfill = require('./polyfill'); | ||
var shim = require('./shim'); | ||
|
||
module.exports = { | ||
__proto__: getPolyfill(), | ||
getPolyfill: getPolyfill, | ||
implementation: implementation, | ||
shim: shim | ||
}; |
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,7 @@ | ||
'use strict'; | ||
|
||
var implementation = require('./implementation'); | ||
|
||
module.exports = function getPolyfill() { | ||
return implementation; | ||
}; |
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,20 @@ | ||
'use strict'; | ||
|
||
var getPolyfill = require('./polyfill'); | ||
var define = require('define-properties'); | ||
|
||
var getIteratorPolyfill = require('../Iterator/polyfill'); | ||
|
||
module.exports = function shimIteratorFrom() { | ||
var $Iterator = getIteratorPolyfill(); | ||
var polyfill = getPolyfill(); | ||
define( | ||
$Iterator, | ||
{ prototype: polyfill }, | ||
{ prototype: function () { return $Iterator.prototype !== polyfill; } } | ||
); | ||
|
||
// TODO: install Symbol.toStringTag if needed, once https://bugs.chromium.org/p/chromium/issues/detail?id=1477372 is fixed? | ||
|
||
return polyfill; | ||
}; |
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
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
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
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
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
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
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,72 @@ | ||
'use strict'; | ||
|
||
var defineProperties = require('define-properties'); | ||
var test = require('tape'); | ||
var hasSymbols = require('has-symbols')(); | ||
var hasToStringTag = require('has-tostringtag'); | ||
var functionsHaveNames = require('functions-have-names')(); | ||
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); | ||
|
||
var index = require('../Iterator.prototype'); | ||
var impl = require('../Iterator.prototype/implementation'); | ||
|
||
var isEnumerable = Object.prototype.propertyIsEnumerable; | ||
|
||
var $Iterator = require('../Iterator/implementation'); | ||
|
||
module.exports = { | ||
tests: function (proto, name, t) { | ||
t.notEqual(proto, null, 'is not null'); | ||
t.equal(typeof proto, 'object', 'is an object'); | ||
|
||
t.test('Symbol.iterator', { skip: !hasSymbols }, function (st) { | ||
st.equal(typeof proto[Symbol.iterator], 'function', 'has a `Symbol.iterator` method'); | ||
st.equal( | ||
proto[Symbol.iterator].name, | ||
'[Symbol.iterator]', | ||
'has name "[Symbol.iterator]"', | ||
{ skip: functionsHaveNames && !functionsHaveConfigurableNames } | ||
); | ||
st.equal(proto[Symbol.iterator](), proto, 'function returns proto'); | ||
st.equal(proto[Symbol.iterator].call($Iterator), $Iterator, 'function returns receiver'); | ||
|
||
st.end(); | ||
}); | ||
|
||
t.test( | ||
'Symbol.toStringTag', | ||
{ skip: !hasToStringTag || 'temporarily skipped pending https://bugs.chromium.org/p/chromium/issues/detail?id=1477372' }, | ||
function (st) { | ||
st.equal(proto[Symbol.toStringTag], 'Iterator', 'has a `Symbol.toStringTag` property'); | ||
|
||
st.end(); | ||
} | ||
); | ||
}, | ||
index: function () { | ||
test('Iterator.prototype: index', function (t) { | ||
module.exports.tests(index, 'Iterator.prototype', t); | ||
|
||
t.end(); | ||
}); | ||
}, | ||
implementation: function () { | ||
test('Iterator.prototype: implementation', function (t) { | ||
module.exports.tests(impl, 'Iterator.prototype', t); | ||
|
||
t.end(); | ||
}); | ||
}, | ||
shimmed: function () { | ||
test('Iterator.prototype: shimmed', function (t) { | ||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { | ||
et.equal(false, isEnumerable.call(Iterator, 'prototype'), 'Iterator.prototype is not enumerable'); | ||
et.end(); | ||
}); | ||
|
||
module.exports.tests(Iterator.prototype, 'Iterator.prototype', 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