JSPM

enum-nom-nommer

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

Create a numeric or mixed enumeration (enum) from a plain-old JavaScript object.

Package Exports

  • enum-nom-nommer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (enum-nom-nommer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

enum-nom-nommer

The MIT License NPM version FOSSA Status Known Vulnerabilities
Dependency Status Development Dependency Status
MacOS and Ubuntu build statuses Windows build status Coverage percentage Codacy code quality

Create a numeric or mixed enumeration (enum) from a plain-old JavaScript object.

Table of Contents

1. Install

npm i enum-nom-nommer

Back to Table of contents [toc]

2. Usage

Test it out on RunKit.com Test enum-nom-nommer in your Web browser on RunKit Try enum-nom-nommer on RunKit.


Create a numeric (indexed) enumeration:

const { enumFactory } = require('enum-nom-nommer')

const levels = {
  debug: 5,
  error: 0,
  http: 3
  info: 2,
  silly: 6,
  verbose: 4,
  warn: 1
}

const logLevelsEnum = enumFactory.create(levels)
/* =>
{
  0: 'error',
  1: 'warn',
  2: 'info',
  3: 'http',
  4: 'verbose',
  5: 'debug',
  6: 'silly',
  debug: 5,
  error: 0,
  http: 3,
  info: 2,
  silly: 6,
  verbose: 4,
  warn: 1
}
*/

Create a mixed-type enum:

const validSignatureTypes = {
  MATCH: "match",
  REGEX: "regex",
  match: 0,
  regex: 1
};
const validTypesEnum = enumFactory.create(validSignatureTypes);
/* =>
{
  '0': 'match',
  '1': 'regex',
  'MATCH': 'match',
  'match': 0,
  'REGEX': 'regex',
  'regex': 1
}
*/

Back to Table of contents [toc]

3. Maintainers

Maintenance

@gregswindle

Back to Table of contents [toc]

4. Contributing

GitHub Contributors GitHub GitHub Greenkeeper badge

Gratitude We gratefully accept Pull Requests.

Please review the CONTRIBUTING guidelines and join in.

Back to Table of contents [toc]

5. License

MIT © Greg Swindle

Law View current and detailed legal NOTICE report.

FOSSA Status

Back to Table of contents [toc]