This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds query params to existing URLs (inc merging duplicates) | |
* @param {string} url - src URL to modify | |
* @param {object} params - key/value object of params to add | |
* @example | |
* // returns /guides?tag=api | |
* addQueryParamsToUrl('/guides?tag=hardware', { tag:'api' }) | |
* @example | |
* // returns https://orcascan.com/guides?tag=api | |
* addQueryParamsToUrl('https://orcascan.com/guides?tag=hardware', { tag: 'api' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* local storage helper (takes care of casting types) | |
*/ | |
var localStorageHelper = { | |
/** | |
* Check if item exists in local storage. | |
* @param {string} key - variable name | |
* @return {boolean} true if key exists, otherwise false | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert a URL into a readable filename safe string | |
* - sort query params | |
* - remove protocol | |
* - replace / with ! | |
* - replace ? with !! | |
* - replace remaining illegal characters with - | |
* @example | |
* INPUT: convertUrlToReadableFilename('https://orcascan.com/guides/how-to-scan-barcodes-into-microsoft-excel-59fd67f9'); |
OlderNewer