GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Prototype examples of a standard CMS UI element for managing meta properties

IPUI.common.base.query.where

IPUI.common.base.query > IPUI.query.where(dataObject, condition)

Return members / key value pairs from specified object / has based upon specified condition criteria

Usage


IPUI.requires('common.base.query');
var myObject = {
        1:{
            name: 'paul', 
            gender: 'male',
            age: 10
        },
        2:{
            name: 'rosetta', 
            gender: 'female', 
            age: 7
        },
        3:{
            name: 'max', 
            gender: 'unknown', 
            age: 50
        }
          };

var newObject = IPUI.query.where(myObject, 'name="paul"');

/*newObject will reflect the where condition of any name key with value of "paul" 
{1:{
    name: 'paul', 
    gender: 'male', 
    age: 10
}};
*/

var newObject = IPUI.query.where(myObject, 'age > 30');

/*newObject will reflect the where condition of any name key with value of "paul" 
{1:{
    name: 'max', 
    gender: 'unknown', 
    age: 50
}};
*/

Expects

Param Description
Object as Object The key value / hash / object that is to be sorted
Condition as String The condition that specifies the data query
Condition Operators Description
!= Is Not Equal To
= Is Equal To
> Is Greater Than
< Is Less Than
is null Specified Key / Member does not exist
is not null Specified Key / Member does exist

Returns Object that is the result of the specified condition

Last edited by echai, 4 months ago
Versions: