mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 02:50:10 +00:00
notes and minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
867e51842a
commit
d3ac8e3a46
43
diff.js
43
diff.js
@ -6,13 +6,6 @@
|
||||
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||
(function(require){ var module={} // make module AMD/node compatible...
|
||||
/*********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
// Helpers...
|
||||
|
||||
// zip(array, array, ...)
|
||||
@ -629,14 +622,21 @@ var Types = {
|
||||
// // type .priority is set to a non 0 value.
|
||||
// //
|
||||
// // Default priorities:
|
||||
// // 50 - 'Basic'
|
||||
// // -50 - Object
|
||||
// // Text: 100
|
||||
// // Needs to run checks before 'Basic' as its targets are
|
||||
// // long strings that 'Basic' also catches.
|
||||
// // Basic: 50
|
||||
// // Needs to be run before we do other object checks.
|
||||
// // Object: -100
|
||||
// // Needs to run after everything else as it will match any
|
||||
// // set of objects.
|
||||
// //
|
||||
// // General guide:
|
||||
// // >50 - to be checked before 'Basic'
|
||||
// // <50 and >0 - after Basic but before unprioritized types
|
||||
// // <-50 and <0 - after unprioritized typee but before Object
|
||||
// // <-50 - to be checked after Object
|
||||
// // <-50 and <0 - after unprioritized types but before Object
|
||||
// // <-100 - to be checked after Object -- this is a bit
|
||||
// // pointless in JavaScript.
|
||||
// //
|
||||
// // NOTE: when this is set to 0, then type will be checked in
|
||||
// // order of occurrence...
|
||||
@ -647,7 +647,9 @@ var Types = {
|
||||
// // .check(obj[, options])
|
||||
// // -> bool
|
||||
// //
|
||||
// check: function(obj, options){ .. },
|
||||
// check: function(obj, options){
|
||||
// ..
|
||||
// },
|
||||
//
|
||||
// // Handle/populate the diff of A and B...
|
||||
// //
|
||||
@ -656,17 +658,28 @@ var Types = {
|
||||
// // type: <type-name>,
|
||||
// // }
|
||||
// //
|
||||
// handle: function(obj, diff, A, B, options){ .. },
|
||||
// handle: function(obj, diff, A, B, options){
|
||||
// ..
|
||||
// },
|
||||
//
|
||||
// // Flatten a diff...
|
||||
// //
|
||||
// // .flatten(diff, res, path, options)
|
||||
// // -> res
|
||||
// //
|
||||
// flatten: function(diff, res, path, options){ .. },
|
||||
// flatten: function(diff, res, path, options){
|
||||
// ..
|
||||
// },
|
||||
// }
|
||||
//
|
||||
//
|
||||
// NOTE: to add attribute checking to a specific type add it to
|
||||
// options.as_object...
|
||||
// XXX need a more flexible way to configure this, preferably from
|
||||
// within the handler...
|
||||
// XXX would also need to enable attribute filtering, at least for
|
||||
// arrays as this will also check all the number keys...
|
||||
//
|
||||
// XXX do not like that we need to explicitly pass context to helper
|
||||
// methods...
|
||||
//
|
||||
@ -705,7 +718,7 @@ Types.set('Basic', {
|
||||
// Object...
|
||||
// XXX add attr order support...
|
||||
Types.set(Object, {
|
||||
priority: -50,
|
||||
priority: -100,
|
||||
|
||||
handle: function(obj, diff, A, B, options){
|
||||
// attrebutes/items...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user