Skip to content

Commit

Permalink
removing helpers that are now in can-diff
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Apr 9, 2018
1 parent dc9cc07 commit 49f7f25
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 37 deletions.
33 changes: 21 additions & 12 deletions can-query-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ function makeReturnValue(prop) {
};
}

canReflect.assignSymbols(QueryLogic.prototype,{
"can.getSchema": function(){
return this.schema;
}
});

canReflect.assign(QueryLogic.prototype,{
union: makeNewSet("union"),
difference: makeNewSet("difference"),
Expand All @@ -96,6 +102,7 @@ canReflect.assign(QueryLogic.prototype,{

// identity keys
identityKeys: function(){
console.warn("you probably can get the identity keys some other way");
return this.schema.identity;
},

Expand Down Expand Up @@ -128,21 +135,23 @@ canReflect.assign(QueryLogic.prototype,{
},

memberIdentity: function(props) {
var identity = this.schema.identity;
if(!identity || identity.length === 0) {
throw new Error("Provide an an identity property to your schema.");
} else if(identity.length === 1) {
return canReflect.getKeyValue(props, identity[0]);
} else {
var id = {};
identity.forEach(function(key){
id[key] = canReflect.getKeyValue(props, key);
});
return JSON.stringify(id);
}
console.warn("you probably can get the member identity some other way");
return canReflect.getIdentity(props, this.schema);
},
index: function(query, items, props){
return this.hydrate(query).index(props, items);
},

insert: function(query, items, item){
var index = this.index(query, items, item);
if(index === undefined) {
index = items.length;
}

var copy = items.slice(0);
copy.splice(index, 0, item);

return copy;
}

});
Expand Down
2 changes: 1 addition & 1 deletion doc/can-query-logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ QueryLogic.defineComparison(SearchableStringSet,SearchableStringSet,{
// searchB.
difference(searchA, searchB){
// if searchA's text contains searchB's text, then
// searchA has outside what searchB would return.
// searchA has nothing outside what searchB would return.
if(searchA.value.includes(searchB.value)) {
// A:`food` \ B:`foo` => ∅
return QueryLogic.EMPTY;
Expand Down
11 changes: 0 additions & 11 deletions helpers/index-by-id.js

This file was deleted.

12 changes: 0 additions & 12 deletions helpers/update-except-id.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"can-assign": "^1.1.1",
"can-define-lazy-value": "^1.0.2",
"can-key": "<2.0.0",
"can-reflect": "^1.13.3",
"can-reflect": "^1.14.1",
"can-symbol": "^1.6.1"
},
"devDependencies": {
Expand Down

0 comments on commit 49f7f25

Please sign in to comment.