is-extended
Advanced tools
Comparing version 0.0.1 to 0.0.2
35
index.js
(function () { | ||
"use strict"; | ||
function defineIsa(extender) { | ||
function defineIsa(extended) { | ||
@@ -13,2 +13,12 @@ var undef, pSlice = Array.prototype.slice; | ||
function keys(obj) { | ||
var ret = []; | ||
for (var i in obj) { | ||
if (obj.hasOwnProperty(i)) { | ||
ret.push(i); | ||
} | ||
} | ||
return ret; | ||
} | ||
//taken from node js assert.js | ||
@@ -21,3 +31,3 @@ //https://github.com/joyent/node/blob/master/lib/assert.js | ||
} else if (Buffer && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { | ||
} else if (typeof Buffer !== "undefined" && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { | ||
if (actual.length !== expected.length) { | ||
@@ -52,2 +62,4 @@ return false; | ||
// equivalence is determined by ==. | ||
} else if (isString(actual) && isString(expected) && actual !== expected) { | ||
return false; | ||
} else if (typeof actual !== 'object' && typeof expected !== 'object') { | ||
@@ -88,4 +100,4 @@ return actual === expected; | ||
try { | ||
var ka = Object.keys(a), | ||
kb = Object.keys(b), | ||
var ka = keys(a), | ||
kb = keys(b), | ||
i; | ||
@@ -376,3 +388,3 @@ // having the same number of owned properties (keys incorporates | ||
function addToSwitcher(func) { | ||
switcher[func] = function isaTester(val) { | ||
switcher[func] = function isaTester() { | ||
var args = argsToArray(arguments, 1), isFunc = isa[func], handler, doBreak = true; | ||
@@ -392,3 +404,2 @@ if (args.length <= isFunc.length - 1) { | ||
this._cases.push(function (testArgs) { | ||
var ret; | ||
if (isFunc.apply(isa, testArgs.concat(args))) { | ||
@@ -409,5 +420,5 @@ return [doBreak, handler.apply(this, testArgs)]; | ||
var is = extender.define(isa).expose(isa); | ||
is.tester = extender.define(tester); | ||
is.switcher = extender.define(switcher); | ||
var is = extended.define(isa).expose(isa); | ||
is.tester = extended.define(tester); | ||
is.switcher = extended.define(switcher); | ||
return is; | ||
@@ -419,3 +430,3 @@ | ||
if ("undefined" !== typeof module && module.exports) { | ||
module.exports = defineIsa(require("extender")); | ||
module.exports = defineIsa(require("extended")); | ||
@@ -425,8 +436,8 @@ } | ||
define(["require"], function (require) { | ||
return defineIsa((require("extender"))); | ||
return defineIsa((require("extended"))); | ||
}); | ||
} else { | ||
this.isa = defineIsa(this.extender); | ||
this.is = defineIsa(this.extended); | ||
} | ||
}).call(this); |
{ | ||
"name": "is-extended", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Module for type detection", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"extender": "0.0.4" | ||
"extended": "0.0.2" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
[![build status](https://secure.travis-ci.org/doug-martin/is-extended.png)](http://travis-ci.org/doug-martin/is-extended) | ||
[![Build Status](https://travis-ci.org/doug-martin/is-extended.png?branch=master)](undefined) | ||
@@ -3,0 +3,0 @@ # is-extended |
@@ -732,5 +732,5 @@ "use strict"; | ||
}).as(module); | ||
}).as(module).run(); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55019
1086
+ Addedextended@0.0.2
+ Addedextended@0.0.2(transitive)
- Removedextender@0.0.4