DIR : /home/kozerus/public_html/pn/uize/site-source/js/Uize/Array/Dupes.todo
/home/kozerus/public_html/pn/uize/site-source/js/Uize/Array
This is a TO DO document for the =Uize.Array.Dupes= module.
Proposed New Methods
Uize.Array.Dupes.getDupes
Returns an array of dupe info objects.
Uize.Array.Dupes.getValueCount
Returns the number of occurrences of the specified value.
Uize.Array.Dupes.getValueCounts
Returns a lookup array of counts per value.
Support Loose Type Comparison
For the =Uize.Array.Dupes.dedupe= method, support canonicalizers that can achieve the effect of loose type comparison.
Canonicalize Primitive Type Values to Strings
One approach for a simple canonicalizer to perform loose type deduping would be to canonicalize primitive type values to strings, and map both null and undefined to a nully value object stand-in object...
...............................
var nullyValueStandin = {};
function (value) {
return (
Uize.isPrimitive (value)
? value + ''
: Uize.isNully (value)
? nullyValueStandin
: value
);
}
...............................
Equivalent Canonical Values
An alternative approach would allow a canonicalizer to return multiple equivalent canonical values...
- when the canonicalizer sees a number value, it would return the number value, the string serialization of the number, and the boolean equivalent of the number
- when the canonicalizer sees a boolean value, it would return the number equivalent of the boolean, and the string serialization of the boolean
- when the canonicalizer sees the value null, it would return the value null, the value 0, and the value undefined
Problems with this approach are...
- canonicalizers should be able to return array values, so how would a canonicalizer that is to return multiple values differentiate that intent from simply returning an array as a canonicalized result? Perhaps the canonicalizer would have to have a property on it to indicate that it uses this signature, so that the return value would not have to be overloaded.
- if a canonicalizer could return multiple values, code that currently does the lookup and the insert would have to be wrapped in a loop to do multiple lookups and multiple inserts
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer