Skip to content

Releases: canjs/can-set

v1.6.0

05 Jul 22:28
Compare
Choose a tag to compare

Add "use strict" #87

v1.5.2

05 Jul 22:08
Compare
Choose a tag to compare

Cleanup markdown sample code #85

Remove duplicate items in Algebra.prototype.getUnion()

17 Jan 19:51
Compare
Choose a tag to compare

Given an algebra:
set.props.id("id")

and these two sets:
{ type: 'a' }
{ area: 'x' }

And these two lists related to the respective sets:
[{ id: 1, type: 'a' area: 'x' }, { id: 2, type: 'a', area: 'y' }]
[{ id: 1, type: 'a' area: 'x' }, { id: 3, type: 'b', area: 'x' }]

Previously, the result of getUnion() would return a simple concatenation of these two lists:
[{ id: 1, type: 'a' area: 'x' }, { id: 2, type: 'a', area: 'y' }, { id: 1, type: 'a' area: 'x' }, { id: 3, type: 'b', area: 'x' }]

This is suboptimal in cases like in can-connect's cache-requests behavior, where the union of several sets may be used to build a query response for yet a different set. Each item should be represented at most once when creating the union. With this release, items in both aItems and bItems are removed from the bItems before concatenating into a union result. The example above becomes:

[{ id: 1, type: 'a' area: 'x' }, { id: 2, type: 'a', area: 'y' }, { id: 3, type: 'b', area: 'x' }]

Note: this doesn't remove all duplicates, just removes duplicates from bItems that are already in aItems -- if aItems already has a duplicate, or bItems has a duplicate not in aItems, it will be preserved.

Fix issues with Algebra.prototype.difference()

04 Jan 22:57
Compare
Choose a tag to compare

This release includes PR #82, which improved the difference() function for set.Algebra -- some differences involving paging were incorrect, now fixed, and differences involving ID fields are now supported as well. Also, undefined is no longer returned; the function now agrees with its documentation and returns false when A - B = A or A - B = ∅ (for sets A and B).

In addition, the documentation for union() in set.Algebra was updated to reflect the actual return value: false if the union cannot be expressed as a Set.

Algebra.has() does not check sorting nor pagination

18 Dec 22:20
Compare
Choose a tag to compare

Previously can-set.Algebra.has() operated somewhat similarly to can-set.Algebra.subset() in that it had a special treatment for when a set had sorting and pagination together, to ensure that sorting/order was checked first. This didn't make sense in the case of has() since it checks instance properties instead of sets, and instances in general do not know their own positions in sorted queries nor do they contain sort information of their own.

This has been released as a minor revision instead of a patch: even though no changes in the can-set tests nor documentation were necessary, we cannot guarantee that it won't break users' code relying on Algebra.has().

Various fixes and docs improvements + setup Greenkeeper and cycle detection

01 Nov 23:35
Compare
Choose a tag to compare
  • Update dependencies to enable Greenkeeper 🌴 #53
  • Include id properties in where clause calculations #64
  • collect results of nested object checks as new object #65
  • Remove generated API docs from the README #69
  • Remove all prerelease package refs #72
  • Add a cycle detection script to test process #75
  • Update docs with new @parent & @collection #76
  • Hide docs that can’t show up in the navigation #77
  • Use the correct symbol for set differences #78

v1.3.2...v1.3.3

Ignore pagination in set.has

09 Aug 16:20
Compare
Choose a tag to compare

can-reflect

23 Jun 03:07
Compare
Choose a tag to compare
v1.3.0

1.3.0

Add set.props.dotNotation

13 Apr 20:49
Compare
Choose a tag to compare

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

Add algebra.id()

10 Mar 20:12
Compare
Choose a tag to compare

Adds algebra.id(props) which is useful for getting the id for a data item.

Fixed in #46

var algebra1 = new set.Algebra(set.props.id("_id"));
algebra1.id({_id: 5}) //-> 5

var algebra2 = new set.Algebra(
  set.props.id("studentId"),
  set.props.id("classId")
);

algebra2.id({studentId: 6, classId: "7", foo: "bar"})
    //-> '{"studentId": 6, "classId": "7"}'