synchronous-autocomplete
Advanced tools
Comparing version 2.1.4 to 2.2.0
{ | ||
"name": "synchronous-autocomplete", | ||
"description": "Fast, simple autocompletion.", | ||
"version": "2.1.4", | ||
"version": "2.2.0", | ||
"main": "index.js", | ||
@@ -9,2 +9,5 @@ "files": [ | ||
"build.js", | ||
"encode.js", | ||
"decode.js", | ||
"schema.proto.js", | ||
"src" | ||
@@ -27,3 +30,4 @@ ], | ||
"hifo": "^1.0.0", | ||
"leven": "^2.1.0" | ||
"leven": "^2.1.0", | ||
"pbf": "^3.1.0" | ||
}, | ||
@@ -39,3 +43,5 @@ "devDependencies": { | ||
"scripts": { | ||
"build": "babel src --presets env --out-dir .", | ||
"transpile": "babel src --presets env --out-dir .", | ||
"pbf": "pbf src/schema.proto >src/schema.proto.js", | ||
"build": "npm run pbf && npm run transpile", | ||
"test": "node test.js | tap-min", | ||
@@ -42,0 +48,0 @@ "prepublishOnly": "npm run build && npm test" |
# synchronous-autocomplete | ||
**Fast, simple autocompletion.** Supports [autocompletion](https://en.wikipedia.org/wiki/Autocomplete) and [Levenshtein](https://en.wikipedia.org/wiki/Levenshtein_distance)-based fuzzy search. Uses precomputed indexes to be fast. | ||
**Fast, simple [autocompletion](https://en.wikipedia.org/wiki/Autocomplete).** Also supports [Levenshtein](https://en.wikipedia.org/wiki/Levenshtein_distance)-based fuzzy search. Uses precomputed indexes to be fast. | ||
@@ -145,4 +145,21 @@ [![npm version](https://img.shields.io/npm/v/synchronous-autocomplete.svg)](https://www.npmjs.com/package/synchronous-autocomplete) | ||
## Storing the index as protocol buffer | ||
[Protocol buffers](https://developers.google.com/protocol-buffers/) (a.k. *protobuf*s) are a compact binary format for structured data serialization. | ||
```js | ||
const encode = require('synchronous-autocomplete/encode') | ||
const fs = require('fs') | ||
// encode & write the index | ||
const encoded = encode({tokens, weights, nrOfTokens, scores, originalIds}) | ||
fs.writeFileSync('index.pbf', encoded) | ||
// read & decode the index | ||
const decoded = decode(fs.readFileSync('index.pbf')) | ||
``` | ||
## Contributing | ||
If you have a question or have difficulties using `synchronous-autocomplete`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/synchronous-autocomplete/issues). |
23536
14
464
165
3
+ Addedpbf@^3.1.0
+ Addedieee754@1.2.1(transitive)
+ Addedpbf@3.3.0(transitive)
+ Addedprotocol-buffers-schema@3.6.0(transitive)
+ Addedresolve-protobuf-schema@2.1.0(transitive)