JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 22
  • Score
    100M100P100Q55973F
  • License MIT

Primordials

Package Exports

  • @darkwolf/primordials

Readme

Primordials

Install

npm i --save @darkwolf/primordials

Usage

// ECMAScript
import * as primordials from '@darkwolf/primordials'
// CommonJS
const primordials = require('@darkwolf/primordials')

const {
  ObjectPrototypeToString,
  ObjectPrototypeToStringTag,
  SymbolIterator,
  ArrayPrototypeSymbolIterator,
  MapPrototypeSymbolIterator,
  SetPrototypeSymbolIterator,
  ArrayIteratorPrototype,
  MapIteratorPrototype,
  SetIteratorPrototype,
  SafeArrayIterator,
  SafeMap,
  SafeSet
} = primordials

ObjectPrototypeToString({}) // => '[object Object]'
ObjectPrototypeToStringTag({}) // => 'Object'

ArrayIteratorPrototype.next = null
const iterator = ArrayPrototypeSymbolIterator([])
iterator.next() // TypeError exception will be thrown
const safeIterator = new SafeArrayIterator([])
safeIterator.next() // => IteratorResult

MapIteratorPrototype.next = null
const mapIterator = MapPrototypeSymbolIterator(new Map())
mapIterator.next() // TypeError exception will be thrown
const safeMapIterator = new SafeMap()[SymbolIterator]()
safeMapIterator.next() // => IteratorResult

SetIteratorPrototype.next = null
const setIterator = SetPrototypeSymbolIterator(new Set())
setIterator.next() // TypeError exception will be thrown
const safeSetIterator = new SafeSet()[SymbolIterator]()
safeSetIterator.next() // => IteratorResult

API Documentation

Contact Me

GitHub: @PavelWolfDark

Telegram: @PavelWolfDark

Email: PavelWolfDark@gmail.com