New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

synchronous-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synchronous-autocomplete - npm Package Compare versions

Comparing version 2.1.4 to 2.2.0

decode.js

12

package.json
{
"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).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc