Taffy DB : JavaScript Utility Functions
As a part of Taffy DB there are a number of functions which are required to be in place. These functions are very likely to be useful in your applications and will help you from include too much duplicate code. As of 1.2 these functions are exposed as part of the TAFFY object.
- TAFFY.mergeObj(obj1,obj2) - This is a simple function that takes the values in obj2 and overwrites them in obj1 and returns the new obj.
- TAFFY.gatherUniques(array) - This takes an array and returns only the unique values out of it in a new array.
- TAFFY.getObjectKeys(ob1,ob2) - This gets the key values from an object and sorts them.
- TAFFY.isSameObject(ob1,ob2) - This checks to see if two objects contain the same material.
- TAFFY.has(ob1,ob2) - This checks to see if the first object contains the material defined in the second object. If the second object is an array it checks to see if the first object contains the matiral defined in any of the array items.
- TAFFY.hasAll(ob1,ob2) - This checks to see if the first object contains the material defined in the second object. If the second object is an array it checks to see if the first object contains the matiral defined in all of the array items.
- TAFFY.isSameArray(ar1,ar2) - This checks to see if two arrays contain the same values in the same order.
- TAFFY.JSON - JSON toolkit from JSON.org
- TAFFY.JSON.stringify(obj) - This takes a JavaScript obj and convert it into text for use with Ajax web services.
- TAFFY.JSON.parse(obj) - This takes JavaScript markup in the JSON format that is a string and convert it into JavaScript values.
- TAFFY.typeOf(variable) - Based on Douglas Crockford's work, this function returns the true type of a JavaScript variable (including Null and Undefined).
- TAFFY.isNumeric(string) - This checks to see if the string contains only numbers.
- TAFFY.isString(variable) - This checks to see if a variable is a string and returns true or false.
- TAFFY.isNumber(variable) - This checks to see if a variable is a number and returns true or false.
- TAFFY.isObject(variable) - This checks to see if a variable is an object and returns true or false.
- TAFFY.isArray(variable) - This checks to see if a variable is an array and returns true or false.
- TAFFY.isBoolean(variable) - This checks to see if a variable is a boolean and returns true or false.
- TAFFY.isFunction(variable) - This checks to see if a variable is a function and returns true or false.
- TAFFY.isNull(variable) - This checks to see if a variable is null and returns true or false.
- TAFFY.isUndefined(variable) - This checks to see if a variable is undefined and returns true or false.
- TAFFY.isTAFFY(variable) - This checks to see if a variable is a Taffy DB collection and returns true or false.