UIZE JavaScript Framework

TO DO - Uize.Util.Lookup

This is a proposal document for a Uize.Util.Lookup module.

1. Introduction

Implement a package to facilitate creating very lightweight and highly performant lookup objects that are safe.

1.1. Features

handles the own property issue in a performant way

2. Instance Methods

2.1. keys

Returns an array, containing the keys for all the items in the lookup, in the order in which the items were defined.

SYNTAX

keysARRAY = myLookup.keys ();

2.2. values

Returns an array, containing the values for all the items in the lookup, in the order in which the items were defined.

SYNTAX

valuesARRAY = myLookup.keys ();

2.3. forEach

Iterates over all the items in the lookup, in the order in which the items were defined, calling the specified iteration handler function and passing the value, key, and item number.

SYNTAX

myLookup.forEach (iterationHandlerFUNC);

2.4. item

DIFFERENT USAGES

Get the Value for an Item

valueANYTYPE = myLookup.item (keySTR);

Set the Value for an Item

myLookup.item (keySTR,valueANYTYPE);

2.5. remove

Removes the specified item or items from the lookup.

DIFFERENT USAGES

Remove a Single Item

myLookup.remove (keySTR);

Remove Multiple Items

myLookup.remove (keysARRAY);

2.6. has

Returns a boolean, indicating whether or not there is an item with the specified key in the lookup.

SYNTAX

hasBOOL = myLookup.has (keySTR);

2.7. clear

Clears the lookup object, removing all items.

SYNTAX

myLookup.clear ();

2.8. init

Lets you initialize the lookup with the specified set of values.

SYNTAX

myLookup.init (keysValuesOBJ);

3. Instance Properties

3.1. length

An integer, indicating the number of items in the lookup.