rjrodger / patrun

A fast pattern matcher on JavaScript object properties.
MIT License
143 stars 19 forks source link

Falsy values and strange behaviour with list() #14

Closed CExTNick closed 4 years ago

CExTNick commented 6 years ago

When inserting empty strings as keys, list() fails to list the added values even though findexact() will find them. Is the following behaviour expected?

var patrun = require('patrun');
var pat;
pat = patrun();
pat.add({
    group: null,
    subgroup: null,
    key: 'value'
}, {a: 'a'});
console.log(pat.list().length); // 1

pat = patrun();
pat.add({
    group: '',
    subgroup: '',
    key: 'value'
}, {a: 'a'});
console.log(pat.list().length); //0
rjrodger commented 6 years ago

thanks - will need to investigate

rjrodger commented 4 years ago

yep, bug - about to be fixed! thank you!