Comparing version
@@ -36,3 +36,16 @@ // Eventify | ||
return { | ||
keys: Object.keys, | ||
// Retrieve the names of an object's properties. | ||
// Delegates to **ECMAScript 5**'s native `Object.keys` | ||
keys: Object.keys || function (obj) { | ||
if (typeof obj !== "object" && typeof obj !== "function" || obj === null) { | ||
throw new TypeError("keys() called on a non-object"); | ||
} | ||
var key, keys = []; | ||
for (key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
keys[keys.length] = key; | ||
} | ||
} | ||
return keys; | ||
}, | ||
@@ -45,6 +58,2 @@ uniqueId: function (prefix) { | ||
has: function (obj, key) { | ||
return hasOwnProperty.call(obj, key); | ||
}, | ||
each: function (obj, iterator, context) { | ||
@@ -65,3 +74,3 @@ var key, i, l; | ||
for (key in obj) { | ||
if (this.has(obj, key)) { | ||
if (obj.hasOwnProperty(key)) { | ||
if (iterator.call(context, obj[key], key, obj) === breaker) { | ||
@@ -68,0 +77,0 @@ return; |
{ | ||
"name": "eventify", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Lightweight module that can be mixed in to any object in order to provide it with custom events. For node.js and the browser. Based on Backbone.Events", | ||
@@ -39,3 +39,3 @@ "author": "Bermi Ferrer <bermi@bermilabs.com>", | ||
"devDependencies": { | ||
"expect.js": "~0.3.1", | ||
"blanket": "1.1.6", | ||
"grunt": "~0.4.x", | ||
@@ -47,3 +47,5 @@ "grunt-cli": "^0.1.13", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"mocha": "~1.20.1" | ||
"mocha": "~1.9.0", | ||
"expect.js": "~0.2.0", | ||
"mocha-spec-cov": "0.0.3" | ||
}, | ||
@@ -67,2 +69,8 @@ "scripts": { | ||
}, | ||
"config": { | ||
"blanket": { | ||
"data-cover-only": "[./,./lib]", | ||
"data-cover-never": "[./node_modules]" | ||
} | ||
}, | ||
"ender": "./lib/ender.js", | ||
@@ -69,0 +77,0 @@ "main": "./lib/eventify.js", |
@@ -476,7 +476,10 @@ (function (root) { | ||
it("if callback is truthy but not a function, `on` should throw an error" + | ||
" just like jQuery", function () { | ||
" just like jQuery", function (done) { | ||
var view = Eventify.enable({}).on('test', 'noop'); | ||
expect(function () { | ||
try { | ||
view.trigger('test'); | ||
}).to.throwException(Error); | ||
} catch (e) { | ||
expect(e).to.be.an(Error); | ||
done(); | ||
} | ||
}); | ||
@@ -483,0 +486,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
47150
1.13%1018
1.29%0
-100%10
25%