1.1.1 • Published 8 years ago

nodetype-enum v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

nodetype-enum

An enum of HTML DOM node types

{
  1: 'element',
  3: 'text',
  7: 'processingInstruction',
  8: 'comment',
  9: 'document',
  10: 'documentType',
  11: 'documentFragment',
  element: 1,
  text: 3,
  processingInstruction: 7,
  comment: 8,
  document: 9,
  documentType: 10,
  documentFragment: 11
}

See Node.nodeType at MDN

Install

npm install nodetype-enum

Usage

const nodeType = require( 'nodetype-enum' )

console.log( nodeType.element ) // 1
console.log( nodeType[ 1 ] ) // 'element'

//get a fresh instance
const fresh = nodeType()

console.log( fresh.element ) // 1

delete fresh.element

console.log( fresh.element ) // undefined

console.log( nodeType.element ) // 1