Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.
/ lib-quote-scoring Public archive

Library for quote scoring calculations

Notifications You must be signed in to change notification settings

karhoo/lib-quote-scoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

lib-quote-scoring

Library for quote scoring calculations

Installation

Add lib-quote-scoring to package.json

"dependencies": {
  "lib-quote-scoring": "github:karhoo/lib-quote-scoring#semver:v0.2.0",
}

And then:

npm i

Usage

In app entry:

import { init } from 'lib-quote-scoring'

init()

This will fetch remote scores config to be used in algorithm.

Note: Library uses Fetch API - make sure to provide polyfill, if necessary.

Use library in a non-blocking manner:

import { getPreferredQuote } from 'lib-quote-scoring'

const quote = getPreferredQuote([])

Or make sure that initialization is finished, before usage:

import { init, getPreferredQuote } from 'lib-quote-scoring'

init().then(() => {
  const quote = getPreferredQuote([])
})

If you need more control over how config is provided, it is possible to use createGetPreferredQuote function:

import { createGetPreferredQuote } from 'lib-quote-scoring/src/createGetPreferredQuote'

const getCustomConfig = () => {
  const config = {} // get custom config object somehow
  return config
}

const getPreferredQuote = createGetPreferredQuote(getCustomConfig)