Description
Loops through each item in the passed array and returns the item whose value is closest to a specified value without going over.
Input Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| array | Any | Yes | Array of JSON objects | 
| attribute | Text | Yes | Property name whose value will be compared to the specified value | 
| value | Number | Yes | Numeric value that each item is being compared to | 
Returns
Type: Any
Returns the JSON object from the passed array whose value (at the specified attribute) was closest to the specified value.
Examples
var items = [
    { "age": 10, "name": "Ethan" },
    { "age": 20, "name": "Annabelle" },
    { "age": 30, "name": "Grant" },
    { "age": 40, "name": "Terri" },
    { "age": 50, "name": "Ben" }
];
// find the item in the array whose 'age' is closest to 25 without going over
// note: the entire object for 'Annabelle' is returned
var item = tools.findByScale(items, "age", 25);
Remarks
Use this function when you have an array of JSON objects and you want to find a particular object based on a numeric value comparison with a property common to all objects in the array.
