diff --git a/backbone-nested.js b/backbone-nested.js index 06334c1..62b212c 100644 --- a/backbone-nested.js +++ b/backbone-nested.js @@ -6,10 +6,18 @@ * Copyright (c) 2011-2012 Aidan Feldman * MIT Licensed (LICENSE) */ -/*global $, _, Backbone */ +/*global require, module, $, _, Backbone */ (function(){ 'use strict'; + var $ = this.$; + var _ = (typeof require === "function" ? require('underscore') : void 0) || this._; + var Backbone = (typeof require === "function" ? require('backbone') : void 0) || this.Backbone; + var deepExtendPlainObjects = (typeof require === "function" ? require('bal-util').deepExtendPlainObjects : void 0) || function(){ + var args = Array.prototype.slice.call(arguments); + args.unshift(true); + return $.extend.apply($,args); + }; var _delayedTriggers = []; Backbone.NestedModel = Backbone.Model.extend({ @@ -296,7 +304,7 @@ }, deepClone: function(obj){ - return $.extend(true, {}, obj); + return deepExtendPlainObjects({}, obj); }, walkPath: function(obj, attrPath, callback, scope){ @@ -315,4 +323,10 @@ }); -}()); + + // Node Export + if ( module && module.exports ) { + module.exports = Backbone; + } + +}).call(this); diff --git a/package.json b/package.json index 7a086ec..9a0f949 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { "name": "backbone-nested", - "version": "1.1.2", + "version": "1.1.3", "description": "A plugin to make Backbone.js keep track of nested attributes.", "dependencies": { - "backbone": "0.9.x" + "bal-util": "~1.16.1" + }, + "peerDependencies": { + "underscore": "~1.4.4", + "backbone": "0.9.2" }, "devDependencies": { "grunt": "0.3.x" @@ -12,9 +16,18 @@ "main": "backbone-nested.js", "repositories": [ { - "type": "git", + "type": "git", "url": "https://github.com/afeld/backbone-nested.git" } ], - "github": "https://github.com/afeld/backbone-nested" + "github": "https://github.com/afeld/backbone-nested", + "author": "Aidan Feldman (https://github.com/afeld)", + "maintainers": [ + "Aidan Feldman (https://github.com/afeld)", + "Benjamin Lupton (https://github.com/balupton)" + ], + "contributors": [ + "Aidan Feldman (https://github.com/afeld)", + "Benjamin Lupton (https://github.com/balupton)" + ] }