Import upstream version 0.2.2+git20130426.1.874eecb
Debian Janitor
2 years ago
0 | (function () { | |
0 | void function(global, callback) { | |
1 | if (typeof module === 'object') { | |
2 | module.exports = callback(); | |
3 | } else if (typeof define === 'function') { | |
4 | define(callback); | |
5 | } else { | |
6 | global.crc32 = callback(); | |
7 | } | |
8 | }(this, function() { | |
1 | 9 | 'use strict'; |
2 | 10 | |
3 | 11 | var table = [], |
88 | 96 | // this isn't that costly, and most uses will be for table assisted mode |
89 | 97 | makeTable(); |
90 | 98 | |
91 | module.exports = function (val, direct) { | |
99 | var exports = function (val, direct) { | |
92 | 100 | var val = (typeof val === 'string') ? strToArr(val) : val, |
93 | 101 | ret = direct ? crcDirect(val) : crcTable(val); |
94 | 102 | |
95 | 103 | // convert to 2's complement hex |
96 | 104 | return (ret >>> 0).toString(16); |
97 | 105 | }; |
98 | module.exports.direct = crcDirect; | |
99 | module.exports.table = crcTable; | |
100 | }()); | |
106 | exports.direct = crcDirect; | |
107 | exports.table = crcTable; | |
108 | ||
109 | return exports; | |
110 | });⏎ |