diff --git a/lib/create_store.js b/lib/create_store.js index c95834c..7e44242 100644 --- a/lib/create_store.js +++ b/lib/create_store.js @@ -1,7 +1,7 @@ var _each = require("lodash-node/modern/collection/forEach"), _isFunction = require("lodash-node/modern/lang/isFunction"), Store = require("./store"), - inherits = require("inherits"); + inherits = require("./util/inherits"); var RESERVED_KEYS = ["flux", "waitFor"]; diff --git a/lib/flux.js b/lib/flux.js index 052e98d..bf60741 100644 --- a/lib/flux.js +++ b/lib/flux.js @@ -1,5 +1,5 @@ var EventEmitter = require("eventemitter3"), - inherits = require("inherits"), + inherits = require("./util/inherits"), objectPath = require("object-path"), _each = require("lodash-node/modern/collection/forEach"), _reduce = require("lodash-node/modern/collection/reduce"), diff --git a/lib/store.js b/lib/store.js index 9e173b5..00f23c5 100644 --- a/lib/store.js +++ b/lib/store.js @@ -1,5 +1,5 @@ var EventEmitter = require("eventemitter3"), - inherits = require("inherits"), + inherits = require("./util/inherits"), _isFunction = require("lodash-node/modern/lang/isFunction"), _isObject = require("lodash-node/modern/lang/isObject"); diff --git a/lib/util/inherits.js b/lib/util/inherits.js new file mode 100644 index 0000000..df6ddb2 --- /dev/null +++ b/lib/util/inherits.js @@ -0,0 +1,43 @@ +// From https://github.com/isaacs/inherits +// inherits is licensed under the ISC license: +// +// +// The ISC License +// +// Copyright (c) Isaac Z. Schlueter +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + }; +} diff --git a/package.json b/package.json index 3ef2076..882f28c 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ }, "dependencies": { "eventemitter3": "^0.1.5", - "inherits": "^2.0.1", "lodash-node": "^3.0.1", "object-path": "^0.6.0" },