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

@cedx/enum

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cedx/enum - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

0

AUTHORS.txt
Cédric Belin <cedric@belin.io>

28

CHANGELOG.md
# Changelog
This file contains highlights of what changes on each version of the [Enums for JS](https://github.com/cedx/enum.js) library.
## Version 3.1.0
## Version [3.2.0](https://github.com/cedx/enum.js/compare/v3.1.0...v3.2.0)
- Added support for browser testing.
- Updated the package dependencies.
## Version [3.1.0](https://github.com/cedx/enum.js/compare/v3.0.0...v3.1.0)
- Changed licensing for the [MIT License](https://opensource.org/licenses/MIT).
- Updated the package dependencies.
## Version 3.0.0
## Version [3.0.0](https://github.com/cedx/enum.js/compare/v2.4.0...v3.0.0)
- Added the `assert()` method.

@@ -14,24 +18,24 @@ - Added the `coerce()` method.

## Version 2.4.0
## Version [2.4.0](https://github.com/cedx/enum.js/compare/v2.3.0...v2.4.0)
- Removed the dependency on [Babel](https://babeljs.io) compiler.
- Updated the package dependencies.
## Version 2.3.0
## Version [2.3.0](https://github.com/cedx/enum.js/compare/v2.2.1...v2.3.0)
- Updated the package dependencies.
## Version 2.2.1
## Version [2.2.1](https://github.com/cedx/enum.js/compare/v2.2.0...v2.2.1)
- Fixed a code generation bug.
- Updated the package dependencies.
## Version 2.2.0
## Version [2.2.0](https://github.com/cedx/enum.js/compare/v2.1.0...v2.2.0)
- Added support for the [Node Security Platform](https://nodesecurity.io) reports.
- Updated the package dependencies.
## Version 2.1.0
## Version [2.1.0](https://github.com/cedx/enum.js/compare/v2.0.1...v2.1.0)
- Updated the package dependencies.
## Version 2.0.1
## Version [2.0.1](https://github.com/cedx/enum.js/compare/v2.0.0...v2.0.1)
- Fixed the build system.
## Version 2.0.0
## Version [2.0.0](https://github.com/cedx/enum.js/compare/v1.3.0...v2.0.0)
- Breaking change: raised the required [Node.js](https://nodejs.org) version.

@@ -43,10 +47,10 @@ - Breaking change: using ES2017 features, like async/await functions.

## Version 1.3.0
## Version [1.3.0](https://github.com/cedx/enum.js/compare/v1.2.0...v1.3.0)
- Updated the package dependencies.
## Version 1.2.0
## Version [1.2.0](https://github.com/cedx/enum.js/compare/v1.1.0...v1.2.0)
- Replaced the [Codacy](https://www.codacy.com) code coverage service by the [Coveralls](https://coveralls.io) one.
- Updated the package dependencies.
## Version 1.1.0
## Version [1.1.0](https://github.com/cedx/enum.js/compare/v1.0.0...v1.1.0)
- Non-scalar values are excluded from the iteration of enumerable properties.

@@ -53,0 +57,0 @@

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ MIT License

@@ -7,12 +7,13 @@ {

"license": "MIT",
"main": "./lib/index",
"main": "./lib/index.js",
"name": "@cedx/enum",
"repository": "cedx/enum.js",
"version": "3.1.0",
"version": "3.2.0",
"devDependencies": {
"@cedx/coveralls": "^4.0.0",
"@cedx/gulp-david": "^10.0.0",
"@cedx/coveralls": "^5.0.0",
"@cedx/gulp-david": "^11.0.0",
"browserify": "^14.4.0",
"chai": "^4.1.2",
"del": "^3.0.0",
"esdoc": "^1.0.2",
"esdoc": "^1.0.3",
"esdoc-node": "^1.0.2",

@@ -22,8 +23,13 @@ "esdoc-standard-plugin": "^1.0.0",

"gulp-eslint": "^4.0.0",
"mocha": "^3.5.0",
"nsp": "^2.8.0",
"nyc": "^11.2.1"
"karma": "^1.7.1",
"karma-browserify": "^5.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-mocha": "^1.3.0",
"mocha": "^4.0.1",
"nsp": "^3.0.0",
"nyc": "^11.3.0",
"watchify": "^3.9.0"
},
"engines": {
"node": ">=8.4.0"
"node": ">=8.9.0"
},

@@ -39,4 +45,4 @@ "keywords": [

"coverage": "coveralls var/lcov.info",
"test": "nyc --report-dir=var --reporter=lcovonly mocha --recursive"
"test": "nyc mocha"
}
}
# Enums for JS
![Runtime](https://img.shields.io/badge/node-%3E%3D8.4-brightgreen.svg) ![Release](https://img.shields.io/npm/v/@cedx/enum.svg) ![License](https://img.shields.io/npm/l/@cedx/enum.svg) ![Downloads](https://img.shields.io/npm/dt/@cedx/enum.svg) ![Dependencies](https://david-dm.org/cedx/enum.js.svg) ![Coverage](https://coveralls.io/repos/github/cedx/enum.js/badge.svg) ![Build](https://travis-ci.org/cedx/enum.js.svg)
![Runtime](https://img.shields.io/badge/node-%3E%3D8.9-brightgreen.svg) ![Release](https://img.shields.io/npm/v/@cedx/enum.svg) ![License](https://img.shields.io/npm/l/@cedx/enum.svg) ![Downloads](https://img.shields.io/npm/dt/@cedx/enum.svg) ![Dependencies](https://david-dm.org/cedx/enum.js.svg) ![Coverage](https://coveralls.io/repos/github/cedx/enum.js/badge.svg) ![Build](https://travis-ci.org/cedx/enum.js.svg)

@@ -32,13 +32,13 @@ Yet another implementation of enumerated types for [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript).

const DayOfWeek = Enum.create({
SUNDAY: 0,
MONDAY: 1,
TUESDAY: 2,
WEDNESDAY: 3,
THURSDAY: 4,
FRIDAY: 5,
SATURDAY: 6
sunday: 0,
monday: 1,
tuesday: 2,
wednesday: 3,
thursday: 4,
friday: 5,
saturday: 6
});
```
The [`Enum.create()`](https://github.com/cedx/enum.js/blob/master/src/enum.js) method creates an anonymous class from the specified object. This class has the same values as the provided object, and some additional helper methods.
The [`Enum.create()`](https://github.com/cedx/enum.js/blob/master/lib/enum.js) method creates an anonymous class from the specified object. This class has the same values as the provided object, and some additional helper methods.

@@ -51,3 +51,3 @@ The created class has a constructor throwing a `TypeError`: it prohibits its instantiation. This class is also freezed to prevent any attempt at modifying its shape.

```javascript
DayOfWeek.isDefined(DayOfWeek.SUNDAY); // true
DayOfWeek.isDefined(DayOfWeek.sunday); // true
DayOfWeek.isDefined('foo'); // false

@@ -59,8 +59,8 @@ ```

```javascript
DayOfWeek.assert(DayOfWeek.MONDAY); // DayOfWeek.MONDAY
DayOfWeek.assert(DayOfWeek.monday); // DayOfWeek.monday
DayOfWeek.assert('foo'); // (throws TypeError)
DayOfWeek.coerce(DayOfWeek.MONDAY); // DayOfWeek.MONDAY
DayOfWeek.coerce(DayOfWeek.monday); // DayOfWeek.monday
DayOfWeek.coerce('bar'); // null
DayOfWeek.coerce('baz', DayOfWeek.TUESDAY); // DayOfWeek.TUESDAY
DayOfWeek.coerce('baz', DayOfWeek.tuesday); // DayOfWeek.tuesday
```

@@ -71,3 +71,3 @@

```javascript
DayOfWeek.getIndex(DayOfWeek.WEDNESDAY); // 3
DayOfWeek.getIndex(DayOfWeek.wednesday); // 3
DayOfWeek.getIndex('foo'); // -1

@@ -79,3 +79,3 @@ ```

```javascript
DayOfWeek.getName(DayOfWeek.THURSDAY); // "THURSDAY"
DayOfWeek.getName(DayOfWeek.thursday); // "thursday"
DayOfWeek.getName('foo'); // "" (empty)

@@ -88,6 +88,6 @@ ```

DayOfWeek.getEntries();
// [["SUNDAY", 0], ["MONDAY", 1], ["TUESDAY", 2], ["WEDNESDAY", 3], ["THURSDAY", 4], ["FRIDAY", 5], ["SATURDAY", 6]]
// [["sunday", 0], ["monday", 1], ["tuesday", 2], ["wednesday", 3], ["thursday", 4], ["friday", 5], ["saturday", 6]]
DayOfWeek.getNames();
// ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"]
// ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]

@@ -94,0 +94,0 @@ DayOfWeek.getValues();

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