1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 'use strict';
-
- var ES2015 = require('./es2015');
- var GetIntrinsic = require('./GetIntrinsic');
- var assign = require('./helpers/assign');
- var $setProto = require('./helpers/setProto');
-
- var callBound = require('./helpers/callBound');
- var getIteratorMethod = require('./helpers/getIteratorMethod');
-
- var $TypeError = GetIntrinsic('%TypeError%');
- var $arrayPush = callBound('Array.prototype.push');
- var $getProto = require('./helpers/getProto');
-
- var ES2016 = assign(assign({}, ES2015), {
-
- SameValueNonNumber: function SameValueNonNumber(x, y) {
- if (typeof x === 'number' || typeof x !== typeof y) {
- throw new TypeError('SameValueNonNumber requires two non-number values of the same type.');
- }
- return this.SameValue(x, y);
- },
-
-
- IterableToArrayLike: function IterableToArrayLike(items) {
- var usingIterator = getIteratorMethod(this, items);
- if (typeof usingIterator !== 'undefined') {
- var iterator = this.GetIterator(items, usingIterator);
- var values = [];
- var next = true;
- while (next) {
- next = this.IteratorStep(iterator);
- if (next) {
- var nextValue = this.IteratorValue(next);
- $arrayPush(values, nextValue);
- }
- }
- return values;
- }
-
- return this.ToObject(items);
- },
-
-
- OrdinaryGetPrototypeOf: function (O) {
- if (this.Type(O) !== 'Object') {
- throw new $TypeError('Assertion failed: O must be an Object');
- }
- if (!$getProto) {
- throw new $TypeError('This environment does not support fetching prototypes.');
- }
- return $getProto(O);
- },
-
-
- OrdinarySetPrototypeOf: function (O, V) {
- if (this.Type(V) !== 'Object' && this.Type(V) !== 'Null') {
- throw new $TypeError('Assertion failed: V must be Object or Null');
- }
-
-
- try {
- $setProto(O, V);
- } catch (e) {
- return false;
- }
- return this.OrdinaryGetPrototypeOf(O) === V;
-
-
- }
- });
-
- module.exports = ES2016;
|