node-primordials.js 1.3 KB

12345678910111213141516171819202122
  1. module.exports = {
  2. ArrayIsArray: Array.isArray,
  3. ArrayPrototypeJoin: (obj, separator) => Array.prototype.join.call(obj, separator),
  4. ArrayPrototypeShift: (obj) => Array.prototype.shift.call(obj),
  5. JSONParse: JSON.parse,
  6. JSONStringify: JSON.stringify,
  7. ObjectFreeze: Object.freeze,
  8. ObjectGetOwnPropertyNames: Object.getOwnPropertyNames,
  9. ObjectPrototypeHasOwnProperty: (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop),
  10. RegExpPrototypeTest: (obj, string) => RegExp.prototype.test.call(obj, string),
  11. SafeMap: Map,
  12. SafeSet: Set,
  13. StringPrototypeEndsWith: (str, ...rest) => String.prototype.endsWith.apply(str, rest),
  14. StringPrototypeIncludes: (str, ...rest) => String.prototype.includes.apply(str, rest),
  15. StringPrototypeLastIndexOf: (str, ...rest) => String.prototype.lastIndexOf.apply(str, rest),
  16. StringPrototypeIndexOf: (str, ...rest) => String.prototype.indexOf.apply(str, rest),
  17. StringPrototypeReplace: (str, ...rest) => String.prototype.replace.apply(str, rest),
  18. StringPrototypeSlice: (str, ...rest) => String.prototype.slice.apply(str, rest),
  19. StringPrototypeSplit: (str, ...rest) => String.prototype.split.apply(str, rest),
  20. StringPrototypeStartsWith: (str, ...rest) => String.prototype.startsWith.apply(str, rest),
  21. StringPrototypeSubstr: (str, ...rest) => String.prototype.substr.apply(str, rest)
  22. };