Skip to content

Commit 0a82ff3

Browse files
committed
Added CommonJS detection.
1 parent 61d4076 commit 0a82ff3

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v0.3.2 / 2016-09-12
2+
3+
* Added CommonJS detection.
4+
15
# v0.3.1 / 2016-09-08
26

37
* Added some files to npm package.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-sha256",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"main": ["src/sha256.js"],
55
"ignore": [
66
"samples",

build/sha256.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-sha256",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "A simple SHA-256 / SHA-224 hash function for JavaScript supports UTF-8 encoding.",
55
"main": "src/sha256.js",
66
"devDependencies": {

src/sha256.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* [js-sha256]{@link https://github.com/emn178/js-sha256}
33
*
4-
* @version 0.3.1
4+
* @version 0.3.2
55
* @author Chen, Yi-Cyuan [[email protected]]
66
* @copyright Chen, Yi-Cyuan 2014-2016
77
* @license MIT
@@ -13,7 +13,7 @@
1313
if (NODE_JS) {
1414
root = global;
1515
}
16-
var TYPED_ARRAY = typeof Uint8Array != 'undefined';
16+
var COMMON_JS = !root.JS_SHA256_TEST && typeof module == 'object' && module.exports;
1717
var HEX_CHARS = '0123456789abcdef'.split('');
1818
var EXTRA = [-2147483648, 8388608, 32768, 128];
1919
var SHIFT = [24, 16, 8, 0];
@@ -217,7 +217,7 @@
217217
return hex;
218218
};
219219

220-
if (!root.JS_SHA256_TEST && NODE_JS) {
220+
if (COMMON_JS) {
221221
sha256.sha256 = sha256;
222222
sha256.sha224 = sha224;
223223
module.exports = sha256;

0 commit comments

Comments
 (0)