Comparing version 0.4.0 to 0.4.1
@@ -46,3 +46,3 @@ /* | ||
var defer = function(callback, argument, context){ | ||
return (kindOf(argument) === "number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument) | ||
return (kindOf(argument) === "Number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument) | ||
} | ||
@@ -49,0 +49,0 @@ |
@@ -118,3 +118,3 @@ /* | ||
var map = function() { | ||
var map = function(){ | ||
return new Map | ||
@@ -125,2 +125,2 @@ } | ||
module.exports = map; | ||
module.exports = map |
{ | ||
"name": "prime", | ||
"homepage": "https://github.com/mootools/prime", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"main": "./index.js", | ||
@@ -17,7 +17,6 @@ "description": "prime, an OOP JavaScript library for node and the web.", | ||
"contributors": [ | ||
"Arian Stolwijk <@arian> (http://aryweb.nl)", | ||
"Cristian Carlesso <@kentaromiura> (http://github.com/kentaromiura)" | ||
"Arian Stolwijk <@arian> (http://aryweb.nl)" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/mootools/prime/issues" | ||
"url": "https://github.com/kamicane/prime/issues" | ||
}, | ||
@@ -27,3 +26,3 @@ "license": "MIT", | ||
"type": "git", | ||
"url": "git://github.com/mootools/prime.git" | ||
"url": "git://github.com/kamicane/prime.git" | ||
}, | ||
@@ -34,12 +33,11 @@ "dependencies": { | ||
"devDependencies": { | ||
"mocha": ">=1.17.1 < 2.0.0", | ||
"expect.js": "~0.2" | ||
"mocha": ">=1.18.2 < 2.0.0", | ||
"expect.js": "~0.3.1", | ||
"istanbul": "~0.2.6", | ||
"coveralls": "~2.10.0", | ||
"mocha-lcov-reporter": "0.0.1" | ||
}, | ||
"optionalDependencies": {}, | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha ./test" | ||
"test": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls" | ||
} | ||
} |
@@ -1,4 +0,9 @@ | ||
[![](https://nodei.co/npm/prime.png)](https://npmjs.org/package/prime) | ||
[![Build Status](https://secure.travis-ci.org/mootools/prime.png?branch=master)](http://travis-ci.org/mootools/prime) | ||
[![Package Info](http://img.shields.io/badge/npm-prime-blue.svg)](https://npmjs.org/package/prime) | ||
[![NPM Version](http://img.shields.io/npm/v/prime.svg)](https://npmjs.org/package/prime) | ||
[![Coverage Status](http://img.shields.io/coveralls/kamicane/prime/master.svg)](https://coveralls.io/r/kamicane/prime) | ||
[![Build Status](http://img.shields.io/travis/kamicane/prime/master.svg)](http://travis-ci.org/kamicane/prime) | ||
[![Dependencies Status](https://david-dm.org/kamicane/prime.svg?theme=shields.io)](https://david-dm.org/kamicane/prime) | ||
[![DevDependencies Status](https://david-dm.org/kamicane/prime/dev-status.svg?theme=shields.io)](https://david-dm.org/kamicane/prime#info=devDependencies) | ||
#prime |prīm| | ||
@@ -53,2 +58,3 @@ | ||
inherits: Animal, | ||
mixin: Emitter, | ||
say: function(){ | ||
@@ -61,4 +67,2 @@ var word = "wuff" + Dog.parent.say.call(this) | ||
Dog.implement(new Emitter) | ||
var barkley = new Dog | ||
@@ -73,3 +77,3 @@ | ||
Simple WeakMap-like object. | ||
Map-like implementation. | ||
@@ -76,0 +80,0 @@ ```js |
@@ -8,2 +8,17 @@ "use strict"; | ||
it('should be able to cancel with return function', function(done){ | ||
var cancel = defer(function(){ | ||
throw new Error('this is not working'); | ||
}); | ||
cancel(); | ||
cancel(); // should not affect anything | ||
setTimeout(function() { | ||
done(); | ||
}, 10); | ||
}) | ||
it('should keep the order of multiple defer calls', function(done){ | ||
@@ -56,3 +71,3 @@ var array = [] | ||
defer.timeout(function(time){ | ||
defer(function(time){ | ||
now1 = time | ||
@@ -59,0 +74,0 @@ expect(this).to.be(object) |
@@ -116,6 +116,4 @@ "use strict"; | ||
var actual = one.constructor.toString().replace(/\s+/g, '') | ||
var expected = (function(){}).toString().replace(/\s+/g, '') | ||
expect(actual).to.be(expected) | ||
expect(Three.prototype.constructor).to.be.a('function') | ||
expect(One.prototype.constructor).to.be.a(Function) | ||
expect(Three.prototype.constructor).to.be.a(Function) | ||
@@ -155,27 +153,37 @@ }) | ||
// it("should implement another prime", function(){ | ||
// var Dog = prime({mixin: Animal}) | ||
// | ||
// var rover = new Dog('rover'); | ||
// expect(rover.name).to.be('rover'); | ||
// expect(rover.initialized).to.be.ok(); | ||
// expect(rover.eat()).to.be('animal:eat:rover'); | ||
// }); | ||
// | ||
// it("should use 'Implements' property to implement any number of primes", function(){ | ||
// var Dog = prime({ | ||
// inherit: Animal, | ||
// mixin: [Actions, Attributes] | ||
// }); | ||
// | ||
// var rover = new Dog('rover'); | ||
// expect(rover.initialized).to.be.ok(); | ||
// expect(rover.eat()).to.be('animal:eat:rover'); | ||
// expect(rover.say()).to.be('animal:say:rover'); | ||
// expect(rover.jump()).to.be('actions:jump:rover'); | ||
// expect(rover.sleep()).to.be('actions:sleep:rover'); | ||
// expect(rover.size()).to.be('attributes:size:rover'); | ||
// expect(rover.color()).to.be('attributes:color:rover'); | ||
// }); | ||
it("should accept functions as constructors", function(){ | ||
var Dog = prime(function(name) { | ||
this.name = name; | ||
}); | ||
var rover = new Dog('rover'); | ||
expect(rover.name).to.be('rover'); | ||
}); | ||
it("should use mixin to implement any number of primes", function(){ | ||
var Dog = prime({ | ||
inherits: Animal, | ||
mixin: [Actions, Attributes] | ||
}); | ||
var rover = new Dog('rover'); | ||
expect(rover.initialized).to.be.ok(); | ||
expect(rover.eat()).to.be('animal:eat:rover'); | ||
expect(rover.say()).to.be('animal:say:rover'); | ||
expect(rover.jump()).to.be('actions:jump:rover'); | ||
expect(rover.sleep()).to.be('actions:sleep:rover'); | ||
expect(rover.size()).to.be('attributes:size:rover'); | ||
expect(rover.color()).to.be('attributes:color:rover'); | ||
var Fox = prime({ | ||
inherits: Animal, | ||
mixin: Actions | ||
}); | ||
var roger = new Fox('roger'); | ||
expect(roger.jump()).to.be('actions:jump:roger'); | ||
expect(roger.sleep()).to.be('actions:sleep:roger'); | ||
}); | ||
it("should alter the prime's prototype when implementing new methods", function(){ | ||
@@ -327,62 +335,1 @@ var Dog = prime({ | ||
}); | ||
// describe('prime Mutators', function(){ | ||
// | ||
// it('should inherit mutators', function(){ | ||
// | ||
// var Being = prime({}); | ||
// Being.defineMutator('Legs', function(legs){ | ||
// this.prototype.legs = legs; | ||
// }); | ||
// | ||
// var Person = prime({ | ||
// inherits: Being, | ||
// Legs: 2, | ||
// BeerCapacity: 10 | ||
// }); | ||
// Person.defineMutator('BeerCapacity', function(beers){ | ||
// this.prototype.beers = beers; | ||
// }); | ||
// | ||
// var Student = prime({ | ||
// inherits: Person, | ||
// Legs: 2, | ||
// BeerCapacity: 10 | ||
// }); | ||
// | ||
// var olmo = new Person(); | ||
// | ||
// expect(olmo.legs).to.be(2); | ||
// expect(olmo.beer).to.beUndefined(); | ||
// | ||
// var arian = new Student(); | ||
// | ||
// expect(arian.legs).to.be(2); | ||
// expect(arian.beers).to.be(10); | ||
// | ||
// }); | ||
// | ||
// }); | ||
// describe('Protected methods', function(){ | ||
// | ||
// it('should throw an error when calling a protected method', function(){ | ||
// var Person = prime({ | ||
// 'protected parse': function(){ | ||
// this.parsed = true; | ||
// return 'parsing...'; | ||
// }, | ||
// get: function(){ | ||
// return this.parse(); | ||
// } | ||
// }); | ||
// var olmo = new Person; | ||
// | ||
// expect(olmo.parse).toThrow(); | ||
// expect(olmo.parsed).to.beFalsy(); | ||
// expect(olmo.get()).to.be('parsing...'); | ||
// expect(olmo.parsed).to.be.ok(); | ||
// | ||
// }); | ||
// | ||
// }); |
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
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
189850
21
961
107
0
5