The Trive Javascript Library
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.
Install Project Dependencies
$ npm iRunning the Test Suite
Because who doesn't love writing tests?
$ ./node_modules/mocha/bin/mocha
# or simply...
$ npm testCompile All the Things!
$ chmod +x compile.sh
$ ./compile.sh
# or simply...
$ npm run-script compileCreate the Documentation!
$ jsdoc --readme /Users/jo/Desktop/libraries/trivefunc/README.md /Users/jo/Desktop/libraries/trivefunc/index.jsCompress All the Things!
$ npm run-script compressPublish to NPM!
# You must be a maintainer
$ npm publishDocumentation
- assembleDateString
- brandKeyToName
- brandRows
- defaultDeviceStatus
- ensureNumber
- filterServicesBidFailure
- filterServicesBidSuccess
- filterServicesMessageBuy
- filterServicesMessageSell
- filterServicesMessageService
- handleMiscPipe
- isValidCarNumber
- mapCsType
- mapServiceType
- reformatDateString
- transformNumber
- transformPrice
- transmissionKeyToName
assembleDateString
// Arguments: year: number | string, month: number | string, day: number | string
// Return Value: string
assembleDateString(1990, 7, 7)
// '19900707'
assembleDateString('1990', '7', '7')
// '19900707'brandKeyToName
// Arguments: brandKey: string
// Return Value: string
brandKeyToName('kia')
// '기아'brandRows
// DOCUMENTATION IN PROGRESSdefaultDeviceStatus
// DOCUMENTATION IN PROGRESSensureNumber
// DOCUMENTATION IN PROGRESSfilterServicesBidFailure
// DOCUMENTATION IN PROGRESSfilterServicesBidSuccess
// DOCUMENTATION IN PROGRESSfilterServicesMessageBuy
// DOCUMENTATION IN PROGRESSfilterServicesMessageSell
// DOCUMENTATION IN PROGRESSfilterServicesMessageService
// DOCUMENTATION IN PROGRESShandleMiscPipe
// DOCUMENTATION IN PROGRESSisValidCarNumber
// Arguments: carNumber: string
// Return Value: boolean
isValidCarNumber('11헐1111')
// true
isValidCarNumber('1191111')
// falsemapCsType
// DOCUMENTATION IN PROGRESSmapServiceType
// DOCUMENTATION IN PROGRESSreformatDateString
// DOCUMENTATION IN PROGRESStransformNumber
// Arguments: original: number | string
// Return Value: string
transformNumber('9999999')
// '9,999,999'
transformNumber(1000)
// '1,000'transformPrice
// 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원'transmissionKeyToName
// Arguments: transmissionKey: string
// Return Value: string
transmissionKeyToName('automatic_')
// '자동'