UNPKG

classifier.js

Version:

:robot: Natural language processing with Javascript

18 lines (16 loc) 372 B
import { ClassifierProps } from '../types' import { toPercent } from './parser' export const { isArray } = Array export const returnTypeParser = ( value: number, options: ClassifierProps['options'] ) => { switch (options?.returnType) { case 'NUMBER': return value case 'PERCENTAGE': return toPercent(value) default: return value } }