Codebase list node-crc32 / 8d73ad3
Import upstream version 0.2.2+git20130426.1.874eecb Debian Janitor 2 years ago
1 changed file(s) with 15 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
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() {
19 'use strict';
210
311 var table = [],
8896 // this isn't that costly, and most uses will be for table assisted mode
8997 makeTable();
9098
91 module.exports = function (val, direct) {
99 var exports = function (val, direct) {
92100 var val = (typeof val === 'string') ? strToArr(val) : val,
93101 ret = direct ? crcDirect(val) : crcTable(val);
94102
95103 // convert to 2's complement hex
96104 return (ret >>> 0).toString(16);
97105 };
98 module.exports.direct = crcDirect;
99 module.exports.table = crcTable;
100 }());
106 exports.direct = crcDirect;
107 exports.table = crcTable;
108
109 return exports;
110 });