cleanup, docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-07-28 02:02:17 +03:00
parent 35408c43ef
commit 7c1fda39ee

32
diff.js
View File

@ -11,6 +11,13 @@ var object = require('ig-object')
/*********************************************************************/
var FORMAT_NAME = 'object-diff'
var FORMAT_VERSION = '0.0.0'
/*********************************************************************/ /*********************************************************************/
// XXX General ToDo: // XXX General ToDo:
// - revise architecture... // - revise architecture...
@ -228,9 +235,11 @@ var EMPTY = {type: 'EMPTY_PLACEHOLDER'}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Logic patterns... // Logic patterns...
// XXX should this also include the above placeholders, especially ANY??? //
// XXX add use-case docs...
// XXX need to avoid recursion... // XXX need to avoid recursion...
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var LogicTypeClassPrototype = { var LogicTypeClassPrototype = {
} }
@ -272,7 +281,7 @@ object.makeConstructor('LogicType',
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// ANY... // Singleton, will compare to anything as true...
var ANY = var ANY =
module.ANY = module.ANY =
new (object.makeConstructor('ANY', Object.assign(new LogicType(), { new (object.makeConstructor('ANY', Object.assign(new LogicType(), {
@ -281,7 +290,7 @@ new (object.makeConstructor('ANY', Object.assign(new LogicType(), {
})))() })))()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// NOT... // Will compare as true to anything but .value...
var NOT = var NOT =
module.NOT = module.NOT =
object.makeConstructor('NOT', Object.assign(new LogicType(), { object.makeConstructor('NOT', Object.assign(new LogicType(), {
@ -293,7 +302,7 @@ object.makeConstructor('NOT', Object.assign(new LogicType(), {
})) }))
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// OR... // Will compare as true if one of the .members compares as true...
var OR = var OR =
module.OR = module.OR =
object.makeConstructor('OR', Object.assign(new LogicType(), { object.makeConstructor('OR', Object.assign(new LogicType(), {
@ -311,7 +320,7 @@ object.makeConstructor('OR', Object.assign(new LogicType(), {
})) }))
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// AND... // Will compare as true if all of the .members compare as true...
var AND = var AND =
module.AND = module.AND =
object.makeConstructor('AND', Object.assign(new LogicType(), { object.makeConstructor('AND', Object.assign(new LogicType(), {
@ -1458,8 +1467,8 @@ function(A, B, options, types){
return { return {
// system meta information... // system meta information...
format: 'object-diff', format: FORMAT_NAME,
varsion: '0.0.0', varsion: FORMAT_VERSION,
structure: options.tree_diff ? 'tree' : 'flat', structure: options.tree_diff ? 'tree' : 'flat',
placeholders: { placeholders: {
NONE: options.NONE || Types.NONE, NONE: options.NONE || Types.NONE,
@ -1495,11 +1504,12 @@ function(diff, obj, options, types){
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// XXX EXPERIMENTAL... // XXX EXPERIMENTAL...
// XXX make this an instance of Types...
// XXX // XXX
var DiffClassPrototype = { var DiffClassPrototype = {
// system meta information... // system meta information...
format: 'object-diff', format: FORMAT_NAME,
version: '0.0.0', version: FORMAT_VERSION,
// XXX PROTOTYPE -- uses Types... // XXX PROTOTYPE -- uses Types...
cmp: function(A, B){ cmp: function(A, B){
@ -1509,6 +1519,8 @@ var DiffClassPrototype = {
fromJSON: function(json){ fromJSON: function(json){
}, },
} }
// XXX hack...
//DiffClassPrototype.__proto__ = Types.clone()
// XXX // XXX
var DiffPrototype = { var DiffPrototype = {