Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enum-xyz

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enum-xyz

JavaScript enums using proxies.

  • 0.1.0
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

enum-xyz

JavaScript enums using proxies.

Based on this tweet

Install

$ npm install enum-xyz --save

Usage

Strings

import Enum from 'enum-xyz'

const { Summer, Autumn, Winter, Spring } = Enum.String

console.log(Summer) // 'Summer'
console.log(Autumn) // 'Autumn'
console.log(Winter) // 'Winter'
console.log(Spring) // 'Spring'

Strings (lowercased)

import Enum from 'enum-xyz'

const { Summer, Autumn, Winter, Spring } = Enum.StringLower

console.log(Summer) // 'summer'
console.log(Autumn) // 'autumn'
console.log(Winter) // 'winter'
console.log(Spring) // 'spring'

Numeric

import Enum from 'enum-xyz'

const { A, B, C, D } = Enum.Numeric

console.log(A) // 0
console.log(B) // 1
console.log(C) // 2
console.log(D) // 3

Numeric Starting at Index

import Enum from 'enum-xyz'

const { A, B, C, D } = Enum.NumericAt(1)

console.log(A) // 1
console.log(B) // 2
console.log(C) // 3
console.log(D) // 4

Keywords

FAQs

Package last updated on 22 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc