tools-enum

0.0.3 • Public • Published

tools-enum

Emulation of typescript enum implementations in javascript.

Install

$ npm install tools-enum

Use

import enumUtil from './index'
const test1 = enumUtil([
  [1, 'String'],
  [2, 'Number'],
  [3, 'Boolean']
])
console.log(test1)****
console.log(test1[1] === 'String', test1['String'] === 1, test1['1'] === 'String')
const test2 = enumUtil(['String', 'Number', 'Boolean'], 1)
console.log(test2)
console.log(test2[1] === 'String', test2['String'] === 1, test2['1'] === 'String')
const example2 = enumUtil({ String: 1, Number: 2, Boolean: 3 })
console.log(example2)
console.log(example2[1] === 'String', example2['String'] === 1, example2['1'] === 'String')

Package Sidebar

Install

npm i tools-enum

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

10.6 kB

Total Files

7

Last publish

Collaborators

  • wang828