Skip to content

Commit

Permalink
Added CommonJS detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
emn178 committed Sep 12, 2016
1 parent f0ff77c commit bb08d1f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.5.4 / 2016-09-12

* Added CommonJS detection.

# v0.5.3 / 2016-09-08

* Added some files to npm package.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-sha3",
"version": "0.5.3",
"version": "0.5.4",
"main": ["src/sha3.js"],
"ignore": [
"samples",
Expand Down
30 changes: 15 additions & 15 deletions build/sha3.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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-sha3",
"version": "0.5.3",
"version": "0.5.4",
"description": "A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 encoding.",
"main": "src/sha3.js",
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions src/sha3.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* [js-sha3]{@link https://github.com/emn178/js-sha3}
*
* @version 0.5.3
* @version 0.5.4
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2015-2016
* @license MIT
Expand All @@ -13,6 +13,7 @@
if (NODE_JS) {
root = global;
}
var COMMON_JS = !root.JS_SHA3_TEST && typeof module == 'object' && module.exports;
var HEX_CHARS = '0123456789abcdef'.split('');
var SHAKE_PADDING = [31, 7936, 2031616, 520093696];
var KECCAK_PADDING = [1, 256, 65536, 16777216];
Expand Down Expand Up @@ -460,7 +461,7 @@
}
}

if (!root.JS_SHA3_TEST && NODE_JS) {
if (COMMON_JS) {
module.exports = methods;
} else if (root) {
for (var key in methods) {
Expand Down

0 comments on commit bb08d1f

Please sign in to comment.