Skip to content
Newer
Older
100644 32 lines (22 sloc) 1.36 KB
4ac18db @kriszyp Added documentation
authored Nov 24, 2010
1 CommonJS Utils is a collection of various CommonJS modules. Modules include:
2
3 # extend-error
4 This module returns a factory for creating custom Error constructors. The extend-error
5 export is a function:
6
7 * ErrorConstructor(name, superError) - Creates a new error constructor. For example:
8
9 MyError = require("commonjs-utils/extend-error")("MyError", Error);
10 ...
11 throw new MyError("something went wrong");
12
13 # json-ext
14 This module allows for JSON-style parsing with additional JavaScript constructs like
15 undefined, NaN, Infinity, and dates. The following functions are exported:
16
17 * parse(str) - Parse the provided JSON-style object, array, or primitive literal string.
18 * stringify(value) - Encodes the provided value as a JSON-style object, array, or primitive literal.
19
20 # base64
21 Provides conversion between JavaScript strings and base64. The base64 module exports:
22
23 * encode(str) - Encode the provided string in base64
24 * decode(base64) - Decode a base64 string to a normal string
25
26 More extensive information on CommonJS utilities can be found here:
939c052 @kriszyp Fixed link
authored Nov 24, 2010
27
ee1936b @kriszyp Fixed link again
authored Nov 24, 2010
28 [http://www.sitepen.com/blog/2010/03/02/commonjs-utilities/](http://www.sitepen.com/blog/2010/03/02/commonjs-utilities/)
2f1555c @kriszyp Updated license
authored Nov 11, 2009
29
30 CommonJS Utils is part of the Persevere project, and therefore is licensed under the
31 AFL or BSD license. The Persevere project is administered under the Dojo foundation,
32 and all contributions require a Dojo CLA.
Something went wrong with that request. Please try again.