Add filters to JBJ.
With npm do:
$ npm install jbj-numerical
var JBJ = require('jbj');
JBJ.use(require('jbj-numerical'));
Compute float footprint
var stylesheet = {
"set": "lorem ipsum",
"floatprint": "abcdefgijklmnopqrstuvwxyz1234567890"
};
JBJ.render(stylesheet, console.log);
// 0.18240444179977044
Naive hashing where the Unicode char are summed.
var stylesheet = {
"set": "lorem ipsum",
"loselose": true
};
JBJ.render(stylesheet, console.log);
// 1133
Pearson 8-bit hash function.
var stylesheet = {
"set": "lorem ipsum",
"pearson": true
};
JBJ.render(stylesheet, console.log);
// 142
### djb2 : true Bernstein's djb2 hash function.
var stylesheet = {
"set": "lorem ipsum",
"djb2": true
};
JBJ.render(stylesheet, console.log);
// 1523634734
Hash function used in sdbm.
var stylesheet = {
"set": "lorem ipsum",
"sdbm": true
};
JBJ.render(stylesheet, console.log);
// 76755323
Fowler–Noll–Vo hash function variant 1a.
var stylesheet = {
"set": "lorem ipsum",
"fnv1a": true
};
JBJ.render(stylesheet, console.log);
// 1505692836
Murmur hash function version 3
var stylesheet = {
"set": "lorem ipsum",
"murmur3": true
};
JBJ.render(stylesheet, console.log);
// 1796952176
distinct counter (use cache)
var stylesheet = {
"set": "lorem ipsum",
"distincter": true
};
JBJ.render(stylesheet, console.log);
// 1
reset cache (use cache)
var stylesheet = {
"set": "lorem ipsum",
"reseter": true
};
JBJ.render(stylesheet, console.log);
// lorem ipsum