1.0.0 • Published 3 years ago

lv_codes v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Codes

This module provides a list of codes codes and messages ,you can change the codes.json file ,use you own code.

Installation

$ npm install lv_codes

API

var codes = require('lv_codes')

const code = codes(Integer || String)

If Integer or String is a valid code or codes message, then the appropriate code will be returned. Otherwise, an error will be thrown.

codes(0) // => 0
codes('1') // => 1
codes(3) // throws, as it's not supported by codes

codes.CODES_MESSAGE

Returns an object which maps codes codes to codes messages.

codes.codes

Returns an array of all the codes codes as Integers.

const msg = codescode

Map of code to codes message. undefined for invalid codes.

codes[0] // => '妈妈'

const code = codesmsg

Map of codes message to code. msg can either be title-cased or lower-cased. undefined for invalid codes messages.

codes['妈妈'] // => 0

codes.feellingcode

Returns true if a codes code is a valid in set codes.

codes.feeling[0] // => true