mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 02:50:10 +00:00
now XOR(..) should work -- needs testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
670ed87d70
commit
c42e988005
20
diff.js
20
diff.js
@ -582,7 +582,7 @@ object.Constructor('NOT', Object.assign(Object.create(Pattern.prototype), {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// Will compare as true if one of the .members compares as true...
|
// Will compare as true if one of the .members compares true...
|
||||||
var OR =
|
var OR =
|
||||||
module.OR =
|
module.OR =
|
||||||
object.Constructor('OR', Object.assign(Object.create(Pattern.prototype), {
|
object.Constructor('OR', Object.assign(Object.create(Pattern.prototype), {
|
||||||
@ -600,19 +600,22 @@ object.Constructor('OR', Object.assign(Object.create(Pattern.prototype), {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// XXX XOR
|
// Will compare as true if one and only one of .members compares true...
|
||||||
|
// XXX TEST...
|
||||||
var XOR =
|
var XOR =
|
||||||
module.XOR =
|
module.XOR =
|
||||||
object.Constructor('XOR', Object.assign(Object.create(Pattern.prototype), {
|
object.Constructor('XOR', Object.assign(Object.create(Pattern.prototype), {
|
||||||
__cmp__: function(obj, cmp, context){
|
__cmp__: function(obj, cmp, context){
|
||||||
/* XXX
|
var state = false
|
||||||
|
var cur
|
||||||
for(var m of this.members){
|
for(var m of this.members){
|
||||||
if(cmp(m, obj, context)){
|
cur = cmp(m, obj, context)
|
||||||
return true
|
if(state == cur && state){
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
state = cur
|
||||||
}
|
}
|
||||||
return false
|
return state
|
||||||
//*/
|
|
||||||
},
|
},
|
||||||
__init__: function(...members){
|
__init__: function(...members){
|
||||||
this.members = members
|
this.members = members
|
||||||
@ -1121,8 +1124,7 @@ module.Types = {
|
|||||||
var that = this
|
var that = this
|
||||||
return this.typeKeys
|
return this.typeKeys
|
||||||
.map(function(e){
|
.map(function(e){
|
||||||
return that.get(e) })
|
return that.get(e) }) },
|
||||||
},
|
|
||||||
|
|
||||||
// helper...
|
// helper...
|
||||||
typeCall: function(type, func, ...args){
|
typeCall: function(type, func, ...args){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user