Skip to content

Add set.props.dotNotation

Compare
Choose a tag to compare
@nlundquist nlundquist released this 13 Apr 20:49
· 63 commits to master since this release

Adds set.props.dotNotation(propertyName) which is useful when using MongoDB-style nested property query params with can-set.

Fixed in #48

var algebra1 = new set.Algebra(set.props.dotNotation("address.city"));
algebra1.has({"address.city": "Chicago"}, {address:{city: "Chicago"}}); //-> true

var algebra2 = new set.Algebra(
  set.props.dotNotation("address.city"),
  set.props.dotNotation("address.state")
);

algebra2.subset({
  "address.city": "Chicago", 
  "address.state": "IL"
}, {
  address: {state: "IL"}
}); //-> true