ember-cli-simple-store
Advanced tools
Comparing version 0.6.2 to 0.7.0
@@ -62,2 +62,7 @@ import Ember from "ember"; | ||
} | ||
if (options instanceof Function) { | ||
var computed_keys = arguments[2]; | ||
Ember.assert("No computed keys found for the filter by function", computed_keys); | ||
return this._findWithFilterFunc(type, options, computed_keys); | ||
} | ||
if (typeof options === "object") { | ||
@@ -97,2 +102,18 @@ var params = Object.keys(options); | ||
}); | ||
}, | ||
_findWithFilterFunc: function(type, filter_func, computed_keys) { | ||
var attributes = []; | ||
computed_keys.forEach(function(computed_key) { | ||
attributes.push("source.@each." + computed_key); | ||
}); | ||
return Ember.ArrayProxy.extend({ | ||
source: undefined, | ||
content: function () { | ||
var filter_func = this.get("filter_func"); | ||
return this.get("source").filter(filter_func); | ||
}.property("" + attributes) | ||
}).create({ | ||
filter_func: filter_func, | ||
source: this._findAll(type) | ||
}); | ||
} | ||
@@ -99,0 +120,0 @@ }); |
{ | ||
"name": "ember-cli-simple-store", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "ember-cli addon that provides a simple identity map for ember.js web applications", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -52,2 +52,13 @@ # ember-cli-simple-store | ||
```js | ||
//find all person models with name toran and salary > 100 | ||
var filter = function(person) { | ||
var name = person.get("name"); | ||
var salary = person.get("salary"); | ||
return name === "toran" && salary > 100; | ||
} | ||
this.store.find("person", filter, ["salary", "name"]); | ||
``` | ||
```js | ||
//find the first person model | ||
@@ -54,0 +65,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28036753
854
320173
230
3
2