Skip to content
This repository has been archived by the owner on Dec 28, 2017. It is now read-only.

Commit

Permalink
fix module interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Shvets committed Apr 14, 2013
1 parent 5021c53 commit bcff358
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -39,8 +39,8 @@ Node.js:

//<node.js>
var clonejs = require('clonejs'),
$object = clonejs.prototype;
//or: var $object = require('clonejs').prototype;
$object = clonejs.$object;
//or: var $object = require('clonejs').$object;
//or: require('clonejs').inject();
//</node.js>
Expand Down
16 changes: 8 additions & 8 deletions src/clone.js
Expand Up @@ -1246,17 +1246,17 @@ if(typeof module != 'undefined' && module.exports){

if('clonejs' in global){
var options = global.clonejs;
}

global.clonejs = exports;

if(options.inject){
injectIntoObjectPrototype();
if(options.inject){
injectIntoObjectPrototype();
}
}
if(options.$object !== false){
global.$object = global.clonejs.$object;

if(!options || options.$object !== false){
global.$object = exports.$object;
}

global.clonejs = exports;
}

return;
Expand Down
4 changes: 2 additions & 2 deletions test/clone.test.js
@@ -1,8 +1,8 @@
// nodeunit

if(typeof $object==='undefined'){
if(typeof clonejs === 'undefined'){
var clonejs = require('../src/clone.js'),
$object = clonejs.prototype;
$object = clonejs.$object;
}

this.tests = {
Expand Down
2 changes: 1 addition & 1 deletion test/conf/nodeunit-browser.html
Expand Up @@ -6,7 +6,7 @@
<link href="../../node_modules/nodeunit/share/nodeunit.css" rel="stylesheet" type="text/css" />
<script src="../../node_modules/nodeunit/examples/browser/nodeunit.js"></script>

<script src="../../node_modules/nodeunit/dist/browser/nodeunit.js"></script>
<!--<script src="../../node_modules/nodeunit/dist/browser/nodeunit.js"></script>-->

<script>var clonejs = {inject: true}</script>
<script src="../../src/clone.js"></script>
Expand Down

0 comments on commit bcff358

Please sign in to comment.