mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 02:50:10 +00:00
minor refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f27bb40275
commit
35408c43ef
46
diff.js
46
diff.js
@ -273,19 +273,30 @@ object.makeConstructor('LogicType',
|
|||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// ANY...
|
// ANY...
|
||||||
var ANYPrototype = {
|
var ANY =
|
||||||
|
module.ANY =
|
||||||
|
new (object.makeConstructor('ANY', Object.assign(new LogicType(), {
|
||||||
__cmp__: function(obj, cmp){
|
__cmp__: function(obj, cmp){
|
||||||
return true },
|
return true },
|
||||||
}
|
})))()
|
||||||
ANYPrototype.__proto__ = LogicTypePrototype
|
|
||||||
|
|
||||||
var ANY =
|
|
||||||
module.ANY = new (object.makeConstructor('ANY', ANYPrototype))()
|
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// NOT...
|
||||||
|
var NOT =
|
||||||
|
module.NOT =
|
||||||
|
object.makeConstructor('NOT', Object.assign(new LogicType(), {
|
||||||
|
__cmp__: function(obj, cmp){
|
||||||
|
return !cmp(this.value, obj) },
|
||||||
|
__init__: function(value){
|
||||||
|
this.value = value
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// OR...
|
// OR...
|
||||||
var ORPrototype = {
|
var OR =
|
||||||
|
module.OR =
|
||||||
|
object.makeConstructor('OR', Object.assign(new LogicType(), {
|
||||||
__cmp__: function(obj, cmp){
|
__cmp__: function(obj, cmp){
|
||||||
for(var m of this.members){
|
for(var m of this.members){
|
||||||
if(cmp(m, obj)){
|
if(cmp(m, obj)){
|
||||||
@ -297,18 +308,13 @@ var ORPrototype = {
|
|||||||
__init__: function(...members){
|
__init__: function(...members){
|
||||||
this.members = members
|
this.members = members
|
||||||
},
|
},
|
||||||
}
|
}))
|
||||||
ORPrototype.__proto__ = LogicTypePrototype
|
|
||||||
|
|
||||||
var OR =
|
|
||||||
module.OR =
|
|
||||||
object.makeConstructor('OR',
|
|
||||||
ORPrototype)
|
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// AND...
|
// AND...
|
||||||
var ANDPrototype = {
|
var AND =
|
||||||
|
module.AND =
|
||||||
|
object.makeConstructor('AND', Object.assign(new LogicType(), {
|
||||||
__cmp__: function(obj, cmp){
|
__cmp__: function(obj, cmp){
|
||||||
for(var m of this.members){
|
for(var m of this.members){
|
||||||
if(!cmp(m, obj)){
|
if(!cmp(m, obj)){
|
||||||
@ -320,13 +326,7 @@ var ANDPrototype = {
|
|||||||
__init__: function(...members){
|
__init__: function(...members){
|
||||||
this.members = members
|
this.members = members
|
||||||
},
|
},
|
||||||
}
|
}))
|
||||||
ANDPrototype.__proto__ = LogicTypePrototype
|
|
||||||
|
|
||||||
var AND =
|
|
||||||
module.AND =
|
|
||||||
object.makeConstructor('AND',
|
|
||||||
ANDPrototype)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user