alamid-junction
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -67,7 +67,7 @@ "use strict"; | ||
if (obj.hasOwnProperty(key)) { | ||
setter(this, key, this.setter(key, obj[key])); | ||
setter(this, key, obj[key]); | ||
} | ||
} | ||
} else { | ||
setter(this, key, this.setter(key, value)); | ||
setter(this, key, value); | ||
} | ||
@@ -224,5 +224,6 @@ | ||
if (signal) { | ||
// the signal will apply the junction's setter as well | ||
signal(value); | ||
} else { | ||
junction._values[key] = value; | ||
junction._values[key] = junction.setter(key, value); | ||
} | ||
@@ -229,0 +230,0 @@ } |
{ | ||
"name": "alamid-junction", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Provides convenient methods for setting and retrieving multiple signals", | ||
@@ -5,0 +5,0 @@ "main": "./lib/Junction.js", |
@@ -45,11 +45,9 @@ "use strict"; | ||
describe(".prototype", function () { | ||
var givenValue; | ||
function Signal() { | ||
var listener, | ||
givenValue; | ||
var listener; | ||
function signal(value) { | ||
if (arguments.length === 1) { | ||
if (signal.setter) { | ||
value = signal.setter(value); | ||
} | ||
givenValue = value; | ||
@@ -242,2 +240,9 @@ listener && listener(value); | ||
it("should only by called once when there is also a signal", function () { | ||
junction.signal("name"); | ||
junction.set("name", "Mighty pirate"); | ||
expect(junction.setter).to.have.been.calledOnce; | ||
}); | ||
}); | ||
@@ -262,7 +267,5 @@ | ||
expect(greeting()).to.equal("Ahoy!"); | ||
expect(age()).to.equal(34); | ||
expect(greeting()).to.equal(34); | ||
junction.reset(); | ||
expect(greeting()).to.equal(undefined); | ||
expect(age()).to.equal(undefined); | ||
}); | ||
@@ -336,14 +339,6 @@ | ||
it("should return a signal representing the value specified by key", function () { | ||
var greeting, | ||
name; | ||
var greeting = junction.signal("greeting"); | ||
junction.set("name", "The mighty pirate"); | ||
name = junction.signal("name"); | ||
greeting = junction.signal("greeting"); | ||
expect(greeting()).to.equal(undefined); | ||
expect(name()).to.equal("The mighty pirate"); | ||
junction.set("greeting", "Ahoy!"); | ||
expect(greeting()).to.equal("Ahoy!"); | ||
@@ -350,0 +345,0 @@ expect(junction.get("greeting")).to.equal("Ahoy!"); |
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
22227
513