forked from MapComplete/MapComplete
More tests
This commit is contained in:
parent
50d383279d
commit
074782c1e0
6 changed files with 52 additions and 56 deletions
|
@ -31,6 +31,15 @@ export default class ComparingTag implements TagsFilter {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the properties match
|
||||
*
|
||||
* const t = new ComparingTag("key", (x => Number(x) < 42))
|
||||
* t.matchesProperties({key: 42}) // => false
|
||||
* t.matchesProperties({key: 41}) // => true
|
||||
* t.matchesProperties({key: 0}) // => true
|
||||
* t.matchesProperties({differentKey: 42}) // => false
|
||||
*/
|
||||
matchesProperties(properties: any): boolean {
|
||||
return this._predicate(properties[this._key]);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ export class Tag extends TagsFilter {
|
|||
* isEmpty.matchesProperties({"key": ""}) // => true
|
||||
* isEmpty.matchesProperties({"other_key": ""}) // => true
|
||||
* isEmpty.matchesProperties({"other_key": "value"}) // => true
|
||||
* isEmpty.matchesProperties({"key": undefined}) // => true
|
||||
*
|
||||
*/
|
||||
matchesProperties(properties: any): boolean {
|
||||
const foundValue = properties[this.key]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue