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

enum

Package Overview
Dependencies
Maintainers
1
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 0.2.3 to 0.2.4

enum-0.2.4.js

4

lib/enum.js

@@ -163,2 +163,4 @@ (function (root, module, global, define) {

get: function(key) {
if (key === null || key === undefined) return null;
if (key instanceof EnumItem || (typeof(key) === 'object' && key.key !== undefined && key.value !== undefined)) {

@@ -207,3 +209,3 @@ return key;

return this.get(result || 'Undefined');
return this.get(result || null);
}

@@ -210,0 +212,0 @@ }

{
"author": "adrai",
"name": "enum",
"version": "0.2.3",
"version": "0.2.4",
"private": false,

@@ -17,3 +17,4 @@ "main": "index.js",

"mocha": ">= 1.0.1",
"expect.js": ">= 0.1.2"
"expect.js": ">= 0.1.2",
"smoosh": ">= 0.4.1"
},

@@ -20,0 +21,0 @@ "description": "Enum is a javascript module that introduces the Enum Type. It works for node.js and in the browser.",

@@ -15,4 +15,4 @@ # Introduction

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

@@ -19,0 +19,0 @@ # Installation (node.js)

@@ -175,3 +175,3 @@ var expect = expect || require('expect.js'),

});
});

@@ -200,3 +200,3 @@ describe('call get and get', function() {

it(' an enum item by key', function() {
it('an enum item by key', function() {

@@ -213,2 +213,22 @@ expect(myEnum.get(1)).to.have.property('value', 1);

describe('call get with null and get', function() {
it('null', function() {
expect(myEnum.get(null)).to.eql(null);
});
});
describe('call get with undefined and get', function() {
it('null', function() {
expect(myEnum.get(undefined)).to.eql(null);
});
});
describe('call getValue and get', function() {

@@ -322,6 +342,6 @@

var myFlaggedEnum;
var myNonFlaggedEnum;
before(function() {
myFlaggedEnum = new e({'A': 1, 'B': 2, 'B2': 3, 'C': 4});
myNonFlaggedEnum = new e({'0': 0, 'A': 1, 'B': 2, 'B2': 3, 'C': 4});
});

@@ -331,5 +351,5 @@

expect(myFlaggedEnum.get(1).is(myFlaggedEnum.A));
expect(myFlaggedEnum.get(2).is(myFlaggedEnum.B));
expect(myFlaggedEnum.get(3).is(myFlaggedEnum.B2));
expect(myNonFlaggedEnum.get(1).is(myNonFlaggedEnum.A));
expect(myNonFlaggedEnum.get(2).is(myNonFlaggedEnum.B));
expect(myNonFlaggedEnum.get(3).is(myNonFlaggedEnum.B2));

@@ -342,3 +362,3 @@ });

expect(myFlaggedEnum.get(5)).to.not.be.ok();
expect(myNonFlaggedEnum.get(5)).to.not.be.ok();

@@ -349,2 +369,22 @@ });

describe('call get with an non valid value and get', function() {
it('null', function() {
expect(myNonFlaggedEnum.get(12345)).to.eql(null);
});
});
describe('call get with 0 and get', function() {
it('null', function() {
expect(myNonFlaggedEnum.get(0)).to.not.eql(null);
});
});
});

@@ -351,0 +391,0 @@

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