mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 18:40:09 +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 =
|
||||
module.OR =
|
||||
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 =
|
||||
module.XOR =
|
||||
object.Constructor('XOR', Object.assign(Object.create(Pattern.prototype), {
|
||||
__cmp__: function(obj, cmp, context){
|
||||
/* XXX
|
||||
var state = false
|
||||
var cur
|
||||
for(var m of this.members){
|
||||
if(cmp(m, obj, context)){
|
||||
return true
|
||||
cur = cmp(m, obj, context)
|
||||
if(state == cur && state){
|
||||
return false
|
||||
}
|
||||
state = cur
|
||||
}
|
||||
return false
|
||||
//*/
|
||||
return state
|
||||
},
|
||||
__init__: function(...members){
|
||||
this.members = members
|
||||
@ -1121,8 +1124,7 @@ module.Types = {
|
||||
var that = this
|
||||
return this.typeKeys
|
||||
.map(function(e){
|
||||
return that.get(e) })
|
||||
},
|
||||
return that.get(e) }) },
|
||||
|
||||
// helper...
|
||||
typeCall: function(type, func, ...args){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user