1'use strict' 2 3/* 4 This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at 5 6 https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js 7 8 Don't try to replace with the original file and keep it up to date with the upstream file. 9*/ 10module.exports = { 11 ArrayIsArray(self) { 12 return Array.isArray(self) 13 }, 14 ArrayPrototypeIncludes(self, el) { 15 return self.includes(el) 16 }, 17 ArrayPrototypeIndexOf(self, el) { 18 return self.indexOf(el) 19 }, 20 ArrayPrototypeJoin(self, sep) { 21 return self.join(sep) 22 }, 23 ArrayPrototypeMap(self, fn) { 24 return self.map(fn) 25 }, 26 ArrayPrototypePop(self, el) { 27 return self.pop(el) 28 }, 29 ArrayPrototypePush(self, el) { 30 return self.push(el) 31 }, 32 ArrayPrototypeSlice(self, start, end) { 33 return self.slice(start, end) 34 }, 35 Error, 36 FunctionPrototypeCall(fn, thisArgs, ...args) { 37 return fn.call(thisArgs, ...args) 38 }, 39 FunctionPrototypeSymbolHasInstance(self, instance) { 40 return Function.prototype[Symbol.hasInstance].call(self, instance) 41 }, 42 MathFloor: Math.floor, 43 Number, 44 NumberIsInteger: Number.isInteger, 45 NumberIsNaN: Number.isNaN, 46 NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, 47 NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, 48 NumberParseInt: Number.parseInt, 49 ObjectDefineProperties(self, props) { 50 return Object.defineProperties(self, props) 51 }, 52 ObjectDefineProperty(self, name, prop) { 53 return Object.defineProperty(self, name, prop) 54 }, 55 ObjectGetOwnPropertyDescriptor(self, name) { 56 return Object.getOwnPropertyDescriptor(self, name) 57 }, 58 ObjectKeys(obj) { 59 return Object.keys(obj) 60 }, 61 ObjectSetPrototypeOf(target, proto) { 62 return Object.setPrototypeOf(target, proto) 63 }, 64 Promise, 65 PromisePrototypeCatch(self, fn) { 66 return self.catch(fn) 67 }, 68 PromisePrototypeThen(self, thenFn, catchFn) { 69 return self.then(thenFn, catchFn) 70 }, 71 PromiseReject(err) { 72 return Promise.reject(err) 73 }, 74 ReflectApply: Reflect.apply, 75 RegExpPrototypeTest(self, value) { 76 return self.test(value) 77 }, 78 SafeSet: Set, 79 String, 80 StringPrototypeSlice(self, start, end) { 81 return self.slice(start, end) 82 }, 83 StringPrototypeToLowerCase(self) { 84 return self.toLowerCase() 85 }, 86 StringPrototypeToUpperCase(self) { 87 return self.toUpperCase() 88 }, 89 StringPrototypeTrim(self) { 90 return self.trim() 91 }, 92 Symbol, 93 SymbolFor: Symbol.for, 94 SymbolAsyncIterator: Symbol.asyncIterator, 95 SymbolHasInstance: Symbol.hasInstance, 96 SymbolIterator: Symbol.iterator, 97 TypedArrayPrototypeSet(self, buf, len) { 98 return self.set(buf, len) 99 }, 100 Uint8Array 101} 102