Comparing version 0.0.2 to 0.1.0
101
package.json
{ | ||
"name": "ethjs-unit", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "A simple module for handling Ethereum units (e.g. 'ether', 'wei', etc...)", | ||
"main": "./src/index.js", | ||
"main": "lib/index.js", | ||
"browser": "dist/ethjs-sha3.js", | ||
"files": [ | ||
"dist", | ||
"internals", | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"start": "npm test", | ||
"test": "mocha src/tests/**/*.js -R spec --timeout 2000000", | ||
"release": "npmpub", | ||
"pretest": "npm run lint", | ||
"prepublish": "npm run build", | ||
"prebuild": "npm run build:clean && npm run test", | ||
"build:clean": "npm run test:clean && rimraf ./dist", | ||
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib --copy-files", | ||
"build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack --config ./internals/webpack/webpack.config.js ./lib/index.js --progress", | ||
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack --config ./internals/webpack/webpack.config.js ./lib/index.js --progress", | ||
"build": "npm run build:commonjs && npm run test:lib && npm run build:umd && npm run build:umd:min", | ||
"lint": "npm run lint:js", | ||
"lint:eslint": "eslint --ignore-path .gitignore", | ||
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern **/**.min.js", | ||
"lint:js": "npm run lint:eslint -- . ", | ||
"lint:staged": "lint-staged", | ||
"test:clean": "rimraf ./coverage", | ||
"test": "mocha ./src/tests/**/*.js -R spec --timeout 2000000", | ||
"test:lib": "mocha ./lib/tests/**/*.js -R spec --timeout 2000000", | ||
"test-travis": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- src/tests/**/*.js -R spec --timeout 2000000", | ||
@@ -22,2 +38,33 @@ "coveralls": "npm run test-travis && cat ./coverage/lcov.info | coveralls" | ||
}, | ||
"babel": { | ||
"plugins": [ | ||
["transform-es2015-template-literals", { "loose": true }], | ||
"transform-es2015-literals", | ||
"transform-es2015-function-name", | ||
"transform-es2015-arrow-functions", | ||
"transform-es2015-block-scoped-functions", | ||
["transform-es2015-classes", { "loose": true }], | ||
"transform-es2015-object-super", | ||
"transform-es2015-shorthand-properties", | ||
["transform-es2015-computed-properties", { "loose": true }], | ||
["transform-es2015-for-of", { "loose": true }], | ||
"transform-es2015-sticky-regex", | ||
"transform-es2015-unicode-regex", | ||
"check-es2015-constants", | ||
["transform-es2015-spread", { "loose": true }], | ||
"transform-es2015-parameters", | ||
["transform-es2015-destructuring", { "loose": true }], | ||
"transform-es2015-block-scoping", | ||
"transform-object-rest-spread", | ||
"transform-es3-member-expression-literals", | ||
"transform-es3-property-literals" | ||
], | ||
"env": { | ||
"commonjs": { | ||
"plugins": [ | ||
["transform-es2015-modules-commonjs", { "loose": true }] | ||
] | ||
} | ||
} | ||
}, | ||
"dependencies": { | ||
@@ -27,2 +74,33 @@ "bignumber.js": "3.0.1" | ||
"devDependencies": { | ||
"babel-cli": "6.18.0", | ||
"babel-core": "6.18.2", | ||
"babel-loader": "6.2.8", | ||
"babel-plugin-check-es2015-constants": "6.8.0", | ||
"babel-plugin-transform-es2015-arrow-functions": "6.8.0", | ||
"babel-plugin-transform-es2015-block-scoped-functions": "6.8.0", | ||
"babel-plugin-transform-es2015-block-scoping": "6.18.0", | ||
"babel-plugin-transform-es2015-classes": "6.18.0", | ||
"babel-plugin-transform-es2015-computed-properties": "6.8.0", | ||
"babel-plugin-transform-es2015-destructuring": "6.19.0", | ||
"babel-plugin-transform-es2015-for-of": "6.18.0", | ||
"babel-plugin-transform-es2015-function-name": "6.9.0", | ||
"babel-plugin-transform-es2015-literals": "6.8.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "6.18.0", | ||
"babel-plugin-transform-es2015-object-super": "6.8.0", | ||
"babel-plugin-transform-es2015-parameters": "6.18.0", | ||
"babel-plugin-transform-es2015-shorthand-properties": "6.18.0", | ||
"babel-plugin-transform-es2015-spread": "6.8.0", | ||
"babel-plugin-transform-es2015-sticky-regex": "6.8.0", | ||
"babel-plugin-transform-es2015-template-literals": "6.8.0", | ||
"babel-plugin-transform-es2015-unicode-regex": "6.11.0", | ||
"babel-plugin-transform-es3-member-expression-literals": "6.5.0", | ||
"babel-plugin-transform-es3-property-literals": "6.5.0", | ||
"babel-plugin-transform-object-rest-spread": "6.19.0", | ||
"babel-register": "6.18.0", | ||
"check-es3-syntax-cli": "0.1.3", | ||
"webpack": "2.1.0-beta.15", | ||
"json-loader": "0.5.4", | ||
"rimraf": "2.3.4", | ||
"cross-env": "1.0.7", | ||
"babel-eslint": "7.1.0", | ||
@@ -82,17 +160,2 @@ "chai": "3.5.0", | ||
"license": "MIT", | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
], | ||
"plugins": [ | ||
[ | ||
"module-resolver", | ||
{ | ||
"root": [ | ||
"./src" | ||
] | ||
} | ||
] | ||
] | ||
}, | ||
"lint-staged": { | ||
@@ -99,0 +162,0 @@ "lint:eslint": "*.js" |
@@ -112,10 +112,8 @@ ## ethjs-unit | ||
<!-- | ||
## Guides | ||
You'll find more detailed information on using default and tailoring it to your needs in our guides: | ||
You'll find more detailed information on using `ethjs-unit` and tailoring it to your needs in our guides: | ||
- [User guide](docs/user-guide.md) - Usage, configuration, FAQ and complementary tools. | ||
- [Developer guide](docs/developer-guide.md) - Contributing to wafr and writing your own plugins & formatters. | ||
--> | ||
- [Developer guide](docs/developer-guide.md) - Contributing to `ethjs-unit`, writing coverage and updates. | ||
@@ -126,8 +124,8 @@ ## Help out | ||
<!-- - Create, enhance, and debug rules (see our guide to ["Working on rules"](./github/CONTRIBUTING.md)). --> | ||
- Create, enhance, and debug ethjs rules (see our guide to ["Working on rules"](./github/CONTRIBUTING.md)). | ||
- Improve documentation. | ||
- Chime in on any open issue or pull request. | ||
- Open new issues about your ideas for making stylelint better, and pull requests to show us how your idea works. | ||
- Open new issues about your ideas for making `ethjs-unit` better, and pull requests to show us how your idea works. | ||
- Add new tests to *absolutely anything*. | ||
- Create or contribute to ecosystem tools, like the plugins for Atom and Sublime Text. | ||
- Create or contribute to ecosystem tools, like modules for encoding or contracts. | ||
- Spread the word. | ||
@@ -134,0 +132,0 @@ |
@@ -46,3 +46,3 @@ const BigNumber = require('bignumber.js'); | ||
if (typeof unitValue === undefined) { | ||
if (typeof unitValue !== 'string') { | ||
throw new Error(`This unit doesn't exists, please use the one of the following units ${JSON.stringify(unitMap, null, 2)}`); | ||
@@ -49,0 +49,0 @@ } |
@@ -27,2 +27,11 @@ const units = require('../index.js'); // eslint-disable-line | ||
describe('getValueOfUnit', () => { | ||
it('should throw when undefined or not string', () => { | ||
function invalidFromWei() { | ||
units.fromWei(1000000000000000000, 'something'); | ||
} | ||
assert.throws(invalidFromWei, Error); | ||
}); | ||
}); | ||
describe('fromWei', () => { | ||
@@ -29,0 +38,0 @@ it('should return the correct value', () => { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
292909
2946
45
12
172
1
3