Skip to content

Commit

Permalink
Added RequireJS compatability.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Gorbatchev authored and Alex Gorbatchev committed Dec 7, 2010
1 parent c771caa commit 64682c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# CRC for node.js

This is a basic port/copy of the JavaScript CRC implementation.
This is a basic port/copy of the JavaScript CRC implementation. The module is compatible with RequireJS.

## Functions

Expand Down
10 changes: 6 additions & 4 deletions lib/crc.js
@@ -1,4 +1,7 @@
(function()
// make this module compatible with RequireJS
typeof(define) == "undefined" && (define = function(deps, factory) { module.exports = factory.apply(this, deps.map(require)); });

define([], function()
{
// CRC-8 in table form
//
Expand Down Expand Up @@ -344,7 +347,7 @@
return str2+str1;
}

module.exports = {
return {
'crc8' : crc8Str,
'crcArc' : crcArcStr,
'crc16' : crc16Str,
Expand All @@ -354,5 +357,4 @@
'hex16' : hex16,
'hex32' : hex32
};

})();
});

0 comments on commit 64682c5

Please sign in to comment.