node-primordials.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. module.exports = {
  2. ArrayFrom: Array.from,
  3. ArrayIsArray: Array.isArray,
  4. ArrayPrototypeShift: (obj) => Array.prototype.shift.call(obj),
  5. ArrayPrototypeForEach: (arr, ...rest) => Array.prototype.forEach.apply(arr, rest),
  6. ArrayPrototypeIncludes: (arr, ...rest) => Array.prototype.includes.apply(arr, rest),
  7. ArrayPrototypeJoin: (arr, ...rest) => Array.prototype.join.apply(arr, rest),
  8. ArrayPrototypePop: (arr, ...rest) => Array.prototype.pop.apply(arr, rest),
  9. ArrayPrototypePush: (arr, ...rest) => Array.prototype.push.apply(arr, rest),
  10. FunctionPrototype: Function.prototype,
  11. JSONParse: JSON.parse,
  12. JSONStringify: JSON.stringify,
  13. ObjectFreeze: Object.freeze,
  14. ObjectKeys: Object.keys,
  15. ObjectGetOwnPropertyNames: Object.getOwnPropertyNames,
  16. ObjectDefineProperty: Object.defineProperty,
  17. ObjectPrototypeHasOwnProperty: (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop),
  18. RegExpPrototypeExec: (obj, string) => RegExp.prototype.exec.call(obj, string),
  19. RegExpPrototypeTest: (obj, string) => RegExp.prototype.test.call(obj, string),
  20. RegExpPrototypeSymbolReplace: (obj, ...rest) => RegExp.prototype[Symbol.replace].apply(obj, rest),
  21. SafeMap: Map,
  22. SafeSet: Set,
  23. SafeWeakMap: WeakMap,
  24. StringPrototypeEndsWith: (str, ...rest) => String.prototype.endsWith.apply(str, rest),
  25. StringPrototypeIncludes: (str, ...rest) => String.prototype.includes.apply(str, rest),
  26. StringPrototypeLastIndexOf: (str, ...rest) => String.prototype.lastIndexOf.apply(str, rest),
  27. StringPrototypeIndexOf: (str, ...rest) => String.prototype.indexOf.apply(str, rest),
  28. StringPrototypeRepeat: (str, ...rest) => String.prototype.repeat.apply(str, rest),
  29. StringPrototypeReplace: (str, ...rest) => String.prototype.replace.apply(str, rest),
  30. StringPrototypeSlice: (str, ...rest) => String.prototype.slice.apply(str, rest),
  31. StringPrototypeSplit: (str, ...rest) => String.prototype.split.apply(str, rest),
  32. StringPrototypeStartsWith: (str, ...rest) => String.prototype.startsWith.apply(str, rest),
  33. StringPrototypeSubstr: (str, ...rest) => String.prototype.substr.apply(str, rest),
  34. StringPrototypeCharCodeAt: (str, ...rest) => String.prototype.charCodeAt.apply(str, rest),
  35. StringPrototypeMatch: (str, ...rest) => String.prototype.match.apply(str, rest),
  36. SyntaxError: SyntaxError
  37. };