@johman/helper
v0.1.0
Published
Joined mini functions to help minimize duplicated coding between projects
Downloads
2
Readme
johman-helper
Joined mini functions to help minimize duplicated coding between projects
Installation
npm install @johman/helper
Peer Dependencies
- lodash: A modern JavaScript utility library delivering modularity, performance & extras.
- iconv-lite: Convert character encodings in pure javascript.
- opencc: Conversion between Traditional and Simplified Chinese.
Note: Peer dependencies are not required for general functionality.
Documentation
- General
- Functions
- delay: Delay in milliseconds with promise
- getWebsiteName: Get name of the website by checking the src
- String.prototype
- capitalize: Capitalize first character in the string
- escapeRegExp: Escape all characters for regular expression
- extractBetween: Extract the string between the start and end string. Return empty if no match found
- Functions
- Required for
lodash
- Functions
- getHeadersCookie: Extract cookie from the headers. Using filter for specific cookie
- getCookieExpireDate: Extract the expire date from cookie string
- getHeadersCookieExpireDate: Extract cookie expire date from the headers. Using filter for specific cookie
- convertToByReference: Pass in function arguments and return as pass by reference
- convertArgumentsToByReference: Same as
convertToByReference
but return in Promise - compactObject: Compact object
- Functions
- Required for
assert
- Functions
- handleTestError: Log the test error and assert for false
- Functions
- Required for
iconv-lite
- String.prototype/Buffer.prototype
- encode: Encode string/buffer with charset
- Buffer.prototype.decode: Decode buffer with charset
- String.prototype/Buffer.prototype
- Required for
opencc
- String.prototype.toTraditional: Translate string to traditional chinese
- String.prototype.toSimplified: Translate string to simplified chinese