A collection of useful library functions, because I got tired of writing the same client-side logic across hybrid mobile and web, and multiple versions of both. The repository can be found here, and the documentation website can be found here.
$ npm i
Because who doesn't love writing tests?
$ ./node_modules/mocha/bin/mocha
# or simply...
$ npm test
$ chmod +x compile.sh
$ ./compile.sh
# or simply...
$ npm run-script compile
$ jsdoc --readme /Users/jo/Desktop/libraries/trivefunc/README.md /Users/jo/Desktop/libraries/trivefunc/index.js
$ npm run-script compress
# You must be a maintainer
$ npm publish
- assembleDateString
- brandKeyToName
- brandRows
- defaultDeviceStatus
- ensureNumber
- filterServicesBidFailure
- filterServicesBidSuccess
- filterServicesMessageBuy
- filterServicesMessageSell
- filterServicesMessageService
- handleMiscPipe
- isValidCarNumber
- mapCsType
- mapServiceType
- reformatDateString
- transformNumber
- transformPrice
- transmissionKeyToName
// Arguments: year: number | string, month: number | string, day: number | string
// Return Value: string
assembleDateString(1990, 7, 7)
// '19900707'
assembleDateString('1990', '7', '7')
// '19900707'
// Arguments: brandKey: string
// Return Value: string
brandKeyToName('kia')
// '기아'
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// Arguments: carNumber: string
// Return Value: boolean
isValidCarNumber('11헐1111')
// true
isValidCarNumber('1191111')
// false
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// DOCUMENTATION IN PROGRESS
// Arguments: original: number | string
// Return Value: string
transformNumber('9999999')
// '9,999,999'
transformNumber(1000)
// '1,000'
// Arguments: price: number
// Return Value: string
transformPrice(0)
// '0원'
transformPrice(990)
// '990원'
transformPrice(1120)
// '1,120원'
transformPrice(19120)
// '1만 9,120원'
transformPrice(129120)
// '12만 9,120원'
transformPrice(99129120)
// '9,912만 9,120원'
transformPrice(600000000)
// '6억원'
transformPrice(600010000)
// '6억 1만원'
transformPrice(699129120)
// '6억 9,912만 9,120원'
transformPrice(55699129120)
// '556억 9,912만 9,120원'
// Arguments: transmissionKey: string
// Return Value: string
transmissionKeyToName('automatic_')
// '자동'