From 35408c43efc07cad88015f3237c1037f9215454c Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 28 Jul 2018 01:40:52 +0300 Subject: [PATCH] minor refactoring... Signed-off-by: Alex A. Naanou --- diff.js | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/diff.js b/diff.js index ba27eef..7ce6720 100644 --- a/diff.js +++ b/diff.js @@ -273,19 +273,30 @@ object.makeConstructor('LogicType', // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ANY... -var ANYPrototype = { +var ANY = +module.ANY = +new (object.makeConstructor('ANY', Object.assign(new LogicType(), { __cmp__: function(obj, cmp){ 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... -var ORPrototype = { +var OR = +module.OR = +object.makeConstructor('OR', Object.assign(new LogicType(), { __cmp__: function(obj, cmp){ for(var m of this.members){ if(cmp(m, obj)){ @@ -297,18 +308,13 @@ var ORPrototype = { __init__: function(...members){ this.members = members }, -} -ORPrototype.__proto__ = LogicTypePrototype - -var OR = -module.OR = -object.makeConstructor('OR', - ORPrototype) - +})) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // AND... -var ANDPrototype = { +var AND = +module.AND = +object.makeConstructor('AND', Object.assign(new LogicType(), { __cmp__: function(obj, cmp){ for(var m of this.members){ if(!cmp(m, obj)){ @@ -320,13 +326,7 @@ var ANDPrototype = { __init__: function(...members){ this.members = members }, -} -ANDPrototype.__proto__ = LogicTypePrototype - -var AND = -module.AND = -object.makeConstructor('AND', - ANDPrototype) +}))