Comparing version 0.0.1 to 0.0.2
@@ -13,5 +13,18 @@ // Cyclone.js: An Adaptation of the HTML5 structured cloning alogrithm. | ||
var __call__ = Function.prototype.call; | ||
var _hasProp = __call__.bind({}.hasOwnProperty); | ||
var _toString = __call__.bind({}.toString); | ||
// Many environments seem to not support nativeBind as of now so because of | ||
// this we'll use our own implementation. | ||
var _bind = function(fn, ctx) { | ||
var slice = [].slice; | ||
// Like native bind, an arbitrary amount of arguments can be passed into | ||
// this function which will automatically be bound to it whenever it's | ||
// called. | ||
var boundArgs = slice.call(arguments, 2); | ||
return function() { | ||
return fn.apply(ctx, boundArgs.concat(slice.call(arguments))); | ||
}; | ||
}; | ||
var _hasProp = _bind(__call__, {}.hasOwnProperty); | ||
var _toString = _bind(__call__, {}.toString); | ||
// Utilities for working with transfer maps. A transfer map is defined as an | ||
@@ -18,0 +31,0 @@ // object that has two properties, `inputs` and `outputs`, each of which |
{ | ||
"name": "cyclonejs", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A pure-javascript adaptation of the W3C's structured cloning algorithm, designed to provide an easy interface for deep copying of complex objects", | ||
@@ -5,0 +5,0 @@ "main": "cyclone.js", |
@@ -39,2 +39,5 @@ [![Build Status](https://travis-ci.org/traviskaufman/cycloneJS.png)](https://travis-ci.org/traviskaufman/cycloneJS) | ||
## Usage | ||
This module exposes a single object, `CY`, into the global scope when used within browsers. A client can then use | ||
this module's `clone` method to perform clone operations. | ||
```javascript | ||
@@ -59,3 +62,9 @@ var o = { | ||
## Testing | ||
Note that cycloneJS also supports AMD loading as well as use within nodeJS, so with node you could do something like | ||
```javascript | ||
var CY = require('cyclonejs'); | ||
// Do some CY.clone()-ing | ||
``` | ||
## Contributing/Testing | ||
First install the module | ||
@@ -67,3 +76,4 @@ ```sh | ||
``` | ||
Then just run `npm test` within the module's directory. | ||
Then just run `npm test` within the module's directory whenever you want to test. This will run jshint on all javascript | ||
files as well as run tests against cyclone. | ||
@@ -70,0 +80,0 @@ ## Coming Soon |
17586
367
81