Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added RequireJS compatability.

  • Loading branch information...
commit 64682c50dd9913e863a958b30353a28bf25a2555 1 parent c771caa
Alex Gorbatchev authored
Showing with 7 additions and 5 deletions.
  1. +1 −1  README.md
  2. +6 −4 lib/crc.js
View
2  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
View
10 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
//
@@ -344,7 +347,7 @@
return str2+str1;
}
- module.exports = {
+ return {
'crc8' : crc8Str,
'crcArc' : crcArcStr,
'crc16' : crc16Str,
@@ -354,5 +357,4 @@
'hex16' : hex16,
'hex32' : hex32
};
-
-})();
+});
Please sign in to comment.
Something went wrong with that request. Please try again.