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

enum

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enum - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

enum-2.2.0.js

12

dist/enum.js

@@ -64,2 +64,3 @@ "use strict";

}
this._enumMap = map;

@@ -268,2 +269,11 @@ if (this._options.ignoreCase) {

/**
* Returns JSON object representation of this Enum.
* @return {String} JSON object representation of this Enum.
*/
Enum.prototype.toJSON = function toJSON() {
return this._enumMap;
};
/**
* Registers the Enum Type globally in node.js.

@@ -288,3 +298,3 @@ * @param {String} key Global variable. [optional]

var reservedKeys = ["_options", "get", "getKey", "getValue", "enums", "isFlaggable"];
var reservedKeys = ["_options", "get", "getKey", "getValue", "enums", "isFlaggable", "_enumMap", "toJSON"];

@@ -291,0 +301,0 @@ function guardReservedKeys(customName, key) {

{
"author": "adrai",
"name": "enum",
"version": "2.1.0",
"version": "2.2.0",
"private": false,

@@ -48,2 +48,6 @@ "main": "index.js",

"test": "gulp test-ci",
"build": "gulp build",
"patch-release": "npm run build && npm run test && npm version patch && npm publish && git push --follow-tags",
"minor-release": "npm run build && npm run test && npm version minor && npm publish && git push --follow-tags",
"major-release": "npm run build && npm run test && npm version major && npm publish && git push --follow-tags",
"prepublish": "gulp"

@@ -50,0 +54,0 @@ },

@@ -24,4 +24,4 @@ # Introduction

|:------------|:----------------|:---------|
| `enum-2.1.0.js` | *uncompressed, with comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.1.0.js) |
| `enum-2.1.0.min.js` | *compressed, without comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.1.0.min.js) |
| `enum-2.2.0.js` | *uncompressed, with comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.2.0.js) |
| `enum-2.2.0.min.js` | *compressed, without comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.2.0.min.js) |

@@ -95,2 +95,5 @@ # Installation (node.js)

myEnum.toJSON(); // returns {'None': 0, 'Black':1, 'Red': 2, 'Red2': 3, 'Green': 4, 'Blue': 5}
JSON.stringify(myEnum); // returns '{"None":0,"Black":1,"Red":2,"Red2":3,"Green":4,"Blue":5}'
for(var i=0; i<=5; i++){ console.log(myEnum.get(i).value + '=> '+ myEnum.get(i).key)}

@@ -104,2 +107,13 @@ 0=> None

// iterating over an enum
myEnum.enums.forEach(function(enumItem) {
console.log(enumItem.key);
});
// => None
// => Black
// => Red
// => Red2
// => Green
// => Blue
// get your item

@@ -106,0 +120,0 @@ myEnum.A

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