harthur/js-select — pull request #3 by MauriceSchoenmakers (2014-02-20 23:33:56+00:00)
Title: added options to change select behavior: "case insensitive" and "use in"

I kindly ask to look at this pull request:

Added an *options* object to be passed as _optional_ third parameter.
and two flags: case_insensitive and use_in:

"case_insensitive": is used as flag to allow to select keys ignoring the case. This allows selectors to stay valid even if there are case changes in json objects keys (p.e. from a REST API). Often the case of the keys is not really important.

"use_in":normally we can now not select keys from objects with a prototype hierarchy, where the key resides in a protoype. With use_in:true, we can also select keys from objects with an prototype hierarchy, as it allows all keys where (k in o) === true;

**Usage**:
see test for "case_insensitive":

```javascript
assert.deepEqual(select(people2, ".age").nodes(), [45, 25])

assert.deepEqual(select(people2, ".Age").nodes(), []);
// options case_insensitive
// use case_insensitive:true to select keys without regarding case
assert.deepEqual(select(people2, ".Age",{case_insensitive:true}).nodes(), [45, 25]);
```

and for "use in":

```javascript
// option use_in
var A=function(){ this.x=1; }
var B=function(){ this.y=2; }
var a = new A();
B.prototype=a;
var b = new B();

assert.deepEqual(select(b, ".y").nodes(), [2]);
assert.deepEqual(select(b, ".x").nodes(), []);
// use in operator to access the key x of the prototype a of the object b
assert.deepEqual(select(b, ".x",{use_in:true}).nodes(), [1]);
```