The fastest node cpf validation lib out there.
Written in rust, compiled to WASM
Install using the package manager of your choice, it already ships with typings
$ npm add cpf-wasm
$ yarn add cpf-wasn
const { isValid } = require('cpf-wasm');
isValid('41154981452')
// true
isValid('11111111111')
// false
A synthetic load of validating 10 million cpfs was ran in order to benchmark our lib against the most popular cpf validation libs on npm. The libs we benchmarked against were:
The results obtained show that cpf-wasm
is at least 1.53 X faster than other libs performing the same task
lib | time | ratio |
---|---|---|
cpf-wasm | 9.23s | 1.00 |
cpf | 19.02s | 2.06 |
@fnando/cpf | 14.10s | 1.53 |
cpf-check | 20.33s | 2.20 |
benchmark code can be found at the benchmark
folder
Probably not
Probably not