Javascript — Automatically ordered array list.The link:
http://www.pastecoin.com/0jEPlease check it out, and if you find it useful, it's not too expensive. Just 0.002 BTC
It may be the first true useful code published in pastecoin! Not a hack-the-blockchain nor instant-lots-of-btc fake code!
If you don't code, but you know someone who does, this can be a good christmas gift.
This is its description:This script can be used to generate an ordered keys object that contains:
- An array storing keys in an alphabetic order (for text type keys) or ascending numerical order (for int and float type keys).
- Methods to add, find and remove keys in the list, keeping them in the right order.
- An array storing variables or objects associated one-by-one with the ordered keys array elements.
- Methods to store and retrieve data associated with each key.
Methods:
.add(keyval); // Adds 'keyval' as a new key and returns in what place on the list it is added.
.find(keyval); // Searches for 'keyval' and returns in which place on the list it is now.
.delete(keyval); // Removes the 'keyval' key from the keys lists (and its associated data), returning form which place it was removed.
.klen(); // Returns the total number of keys. (The keys list array length)
.get(keyval); // Searches for 'keyval' at the keys list and returns the data stored under that key.
.set(keyval,data); // Associates the data parameter to the 'keyval' at the keys list, as an element of the data list.
.addnset(keyval,data); // Adds 'keyval' as a new key and associates the data parameter to it. Returns the key place in the keys list.
.dlen(); // Returns the total number of data array elements. Must be the same as the number of total keys.
.getKeysList(); // Returns the reference to the Keys List array in the object.
.getDataList(); // Returns the reference to the Data List array in the object.
.getType(); // Returns the keys type. 'int', 'float' or 'text'.
Thank you!