Skip to content
Numerical text encoding for JBJ
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.babelrc
.eslintrc
.gitignore
.npmignore
LICENSE
README.md
package.json

README.md

Numerical text processing for JBJ

Add filters to JBJ.

Installation

With npm do:

$ npm install jbj-numerical

Documentation

Usage

var JBJ = require('jbj');

JBJ.use(require('jbj-numerical'));

Filters

floatprint: alphabet

Compute float footprint

var stylesheet = {
  "set": "lorem ipsum",
  "floatprint": "abcdefgijklmnopqrstuvwxyz1234567890"
};
JBJ.render(stylesheet, console.log);
// 0.18240444179977044

loselose : true

Naive hashing where the Unicode char are summed.

var stylesheet = {
  "set": "lorem ipsum",
  "loselose": true
};
JBJ.render(stylesheet, console.log);
// 1133

pearson: true

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

sdbm : true

Hash function used in sdbm.

var stylesheet = {
  "set": "lorem ipsum",
  "sdbm": true
};
JBJ.render(stylesheet, console.log);
// 76755323

fnv1a: true

Fowler–Noll–Vo hash function variant 1a.

var stylesheet = {
  "set": "lorem ipsum",
  "fnv1a": true
};
JBJ.render(stylesheet, console.log);
// 1505692836

murmur3: true

Murmur hash function version 3

var stylesheet = {
  "set": "lorem ipsum",
  "murmur3": true
};
JBJ.render(stylesheet, console.log);
// 1796952176

distincter: true

distinct counter (use cache)

var stylesheet = {
  "set": "lorem ipsum",
  "distincter": true
};
JBJ.render(stylesheet, console.log);
// 1

reseter: true

reset cache (use cache)

var stylesheet = {
  "set": "lorem ipsum",
  "reseter": true
};
JBJ.render(stylesheet, console.log);
// lorem ipsum
You can’t perform that action at this time.