Skip to content

Commit

Permalink
v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vivin committed Nov 2, 2015
1 parent c47dcbb commit 3267cb1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -20,7 +20,7 @@ I figured there must be a better way to realize enums in JavaScript while addres

This works on the browser, in Nashorn, and on Node. The library exposes a single object (called `Enum` if you're on the browser or have loaded the file in Nashorn) with a method called `define`. The signature is `Enum.define(<string>, <array> | <object>)`.

The current version is 1.0.1 and is available [here](https://github.com/vivin/enumjs/releases/tag/v1.0.1). The library is also available as a node package called [**node-enumjs**](https://www.npmjs.com/package/node-enumjs). To install, just run `npm install node-enumjs`. Then you can use it like so:
The current version is 1.0.2 and is available [here](https://github.com/vivin/enumjs/releases/tag/v1.0.2). The library is also available as a node package called [**node-enumjs**](https://www.npmjs.com/package/node-enumjs). To install, just run `npm install node-enumjs`. Then you can use it like so:

```javascript
var Enum = require('node-enumjs');
Expand Down
8 changes: 7 additions & 1 deletion dist/enum.js
@@ -1,7 +1,7 @@
/**
* @preserve
* enum.js - Type-safe enums in JavaScript. Modeled after Java enums.
* Version 1.0.1
* Version 1.0.2
* Written by Vivin Paliath (http://vivin.net)
* License: BSD License
* Copyright (C) 2015
Expand Down Expand Up @@ -162,6 +162,12 @@
}
});

Object.defineProperty(_enum.prototype, "toJSON", {
value: function () {
return this._name;
}
});

/**
* If definition was an array, we can the element values directly. Otherwise, we will have to use the keys
* from the definition.constants object. At this time we can also attach any methods (if provided) to the
Expand Down
4 changes: 2 additions & 2 deletions dist/enum.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "node-enumjs",
"version": "1.0.1",
"version": "1.0.2",
"description": "An implementation of type-safe enums in JavaScript (modeled after Java enums)",
"main": "dist/enum.min.js",
"scripts": {
Expand Down

0 comments on commit 3267cb1

Please sign in to comment.