bitovi / bitovi/training

Explain how to create a custom Compare for can-set algebra

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
weekly-training-topics
Dominant language
JavaScript
Stars
19
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Related issue https://github.com/canjs/can-set/issues/38

E.g. we want a list of items which date is less or equal to a given one:
```js
model.getList( { date: { "$lte": someDate } } );

new set.Algebra(
set.comparators.id("_id"),
{
date: function(a, b, aParent, bParent, ... ){
// a === { "$lte": someDate }
// b === undefined
// aParent === { date: { "$lte": someDate } }
// bParent === {}

return ...;
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading related issue https://github.com/canjs/can-set/issues/38 and the custom set.Algebra example in this issue. Document how to define a custom comparator for the date/$lte case, including the callback arguments shown; done means a newcomer can follow the explanation to create the requested Compare.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.