@dolthub/web-utils 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/Maybe.d.d.ts +3 -0
  2. package/dist/cjs/compareArray.js +2 -0
  3. package/dist/cjs/compareArray.js.map +1 -0
  4. package/dist/cjs/dateConversions.js +2 -0
  5. package/dist/cjs/dateConversions.js.map +1 -0
  6. package/dist/cjs/dedupe.js +2 -0
  7. package/dist/cjs/dedupe.js.map +1 -0
  8. package/dist/cjs/enumKeys.js +2 -0
  9. package/dist/cjs/enumKeys.js.map +1 -0
  10. package/dist/cjs/excerpt.js +2 -0
  11. package/dist/cjs/excerpt.js.map +1 -0
  12. package/dist/cjs/fakeEscapePress.js +2 -0
  13. package/dist/cjs/fakeEscapePress.js.map +1 -0
  14. package/dist/cjs/index.js +1 -1
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/cjs/initialUppercase.js +2 -0
  17. package/dist/cjs/initialUppercase.js.map +1 -0
  18. package/dist/cjs/keycodes.js +2 -0
  19. package/dist/cjs/keycodes.js.map +1 -0
  20. package/dist/cjs/loremer/index.js +2 -0
  21. package/dist/cjs/loremer/index.js.map +1 -0
  22. package/dist/cjs/loremer/words.js +2 -0
  23. package/dist/cjs/loremer/words.js.map +1 -0
  24. package/dist/cjs/nTimes.js +2 -0
  25. package/dist/cjs/nTimes.js.map +1 -0
  26. package/dist/cjs/null.js +2 -0
  27. package/dist/cjs/null.js.map +1 -0
  28. package/dist/cjs/numberFormat.js +2 -0
  29. package/dist/cjs/numberFormat.js.map +1 -0
  30. package/dist/cjs/parseSqlQuery.js +2 -0
  31. package/dist/cjs/parseSqlQuery.js.map +1 -0
  32. package/dist/cjs/pluralize.js +2 -0
  33. package/dist/cjs/pluralize.js.map +1 -0
  34. package/dist/cjs/prettyJSON.js +2 -0
  35. package/dist/cjs/prettyJSON.js.map +1 -0
  36. package/dist/cjs/randomArrayItem.js +2 -0
  37. package/dist/cjs/randomArrayItem.js.map +1 -0
  38. package/dist/cjs/randomNum.js +2 -0
  39. package/dist/cjs/randomNum.js.map +1 -0
  40. package/dist/cjs/safeJSONParse.js +2 -0
  41. package/dist/cjs/safeJSONParse.js.map +1 -0
  42. package/dist/cjs/sprintf.js +2 -0
  43. package/dist/cjs/sprintf.js.map +1 -0
  44. package/dist/cjs/toOrdinal.js +2 -0
  45. package/dist/cjs/toOrdinal.js.map +1 -0
  46. package/dist/cjs/tuplify.js +2 -0
  47. package/dist/cjs/tuplify.js.map +1 -0
  48. package/dist/cjs/urlUtils.js +2 -0
  49. package/dist/cjs/urlUtils.js.map +1 -0
  50. package/dist/cjs/validators.js +2 -0
  51. package/dist/cjs/validators.js.map +1 -0
  52. package/dist/compareArray.d.d.ts +3 -0
  53. package/dist/dateConversions.d.d.ts +15 -0
  54. package/dist/dedupe.d.d.ts +3 -0
  55. package/dist/enumKeys.d.d.ts +22 -0
  56. package/dist/esm/compareArray.js +2 -0
  57. package/dist/esm/compareArray.js.map +1 -0
  58. package/dist/esm/dateConversions.js +2 -0
  59. package/dist/esm/dateConversions.js.map +1 -0
  60. package/dist/esm/dedupe.js +2 -0
  61. package/dist/esm/dedupe.js.map +1 -0
  62. package/dist/esm/enumKeys.js +2 -0
  63. package/dist/esm/enumKeys.js.map +1 -0
  64. package/dist/esm/excerpt.js +2 -0
  65. package/dist/esm/excerpt.js.map +1 -0
  66. package/dist/esm/fakeEscapePress.js +2 -0
  67. package/dist/esm/fakeEscapePress.js.map +1 -0
  68. package/dist/esm/index.js +1 -1
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/initialUppercase.js +2 -0
  71. package/dist/esm/initialUppercase.js.map +1 -0
  72. package/dist/esm/keycodes.js +2 -0
  73. package/dist/esm/keycodes.js.map +1 -0
  74. package/dist/esm/loremer/index.js +2 -0
  75. package/dist/esm/loremer/index.js.map +1 -0
  76. package/dist/esm/loremer/words.js +2 -0
  77. package/dist/esm/loremer/words.js.map +1 -0
  78. package/dist/esm/nTimes.js +2 -0
  79. package/dist/esm/nTimes.js.map +1 -0
  80. package/dist/esm/null.js +2 -0
  81. package/dist/esm/null.js.map +1 -0
  82. package/dist/esm/numberFormat.js +2 -0
  83. package/dist/esm/numberFormat.js.map +1 -0
  84. package/dist/esm/parseSqlQuery.js +2 -0
  85. package/dist/esm/parseSqlQuery.js.map +1 -0
  86. package/dist/esm/pluralize.js +2 -0
  87. package/dist/esm/pluralize.js.map +1 -0
  88. package/dist/esm/prettyJSON.js +2 -0
  89. package/dist/esm/prettyJSON.js.map +1 -0
  90. package/dist/esm/randomArrayItem.js +2 -0
  91. package/dist/esm/randomArrayItem.js.map +1 -0
  92. package/dist/esm/randomNum.js +2 -0
  93. package/dist/esm/randomNum.js.map +1 -0
  94. package/dist/esm/safeJSONParse.js +2 -0
  95. package/dist/esm/safeJSONParse.js.map +1 -0
  96. package/dist/esm/sprintf.js +2 -0
  97. package/dist/esm/sprintf.js.map +1 -0
  98. package/dist/esm/toOrdinal.js +2 -0
  99. package/dist/esm/toOrdinal.js.map +1 -0
  100. package/dist/esm/tuplify.js +2 -0
  101. package/dist/esm/tuplify.js.map +1 -0
  102. package/dist/esm/urlUtils.js +2 -0
  103. package/dist/esm/urlUtils.js.map +1 -0
  104. package/dist/esm/validators.js +2 -0
  105. package/dist/esm/validators.js.map +1 -0
  106. package/dist/excerpt.d.d.ts +3 -0
  107. package/dist/fakeEscapePress.d.d.ts +3 -0
  108. package/dist/index.d.ts +23 -431
  109. package/dist/initialUppercase.d.d.ts +3 -0
  110. package/dist/keycodes.d.d.ts +103 -0
  111. package/dist/loremer/index.d.d.ts +18 -0
  112. package/dist/nTimes.d.d.ts +4 -0
  113. package/dist/null.d.d.ts +6 -0
  114. package/dist/numberFormat.d.d.ts +5 -0
  115. package/dist/parseSqlQuery.d.ts +33 -0
  116. package/dist/pluralize.d.d.ts +3 -0
  117. package/dist/prettyJSON.d.d.ts +4 -0
  118. package/dist/randomArrayItem.d.d.ts +3 -0
  119. package/dist/randomNum.d.d.ts +3 -0
  120. package/dist/safeJSONParse.d.d.ts +3 -0
  121. package/dist/sprintf.d.d.ts +3 -0
  122. package/dist/toOrdinal.d.d.ts +3 -0
  123. package/dist/tsconfig.tsbuildinfo +1 -0
  124. package/dist/tuplify.d.d.ts +3 -0
  125. package/dist/urlUtils.d.d.ts +200 -0
  126. package/dist/validators.d.d.ts +11 -0
  127. package/package.json +13 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prettyJSON.js","sources":["../../../src/prettyJSON.ts"],"sourcesContent":["export default function prettyJSON(data: any): string {\n try {\n return JSON.stringify(data, null, 2);\n } catch (err) {\n console.error(err);\n return `${data}`;\n }\n}\n\nexport function prettyJSONText(text: string): string {\n try {\n return JSON.stringify(JSON.parse(text), null, 2);\n } catch (err) {\n console.error(err);\n return text;\n }\n}\n"],"names":["prettyJSON","data","JSON","stringify","err","console","error","prettyJSONText","text","parse"],"mappings":"AAAc,SAAUA,EAAWC,GACjC,IACE,OAAOC,KAAKC,UAAUF,EAAM,KAAM,EACpC,CAAE,MAAOG,GAEP,OADAC,QAAQC,MAAMF,GACP,GAAGH,GACZ,CACF,CAEM,SAAUM,EAAeC,GAC7B,IACE,OAAON,KAAKC,UAAUD,KAAKO,MAAMD,GAAO,KAAM,EAChD,CAAE,MAAOJ,GAEP,OADAC,QAAQC,MAAMF,GACPI,CACT,CACF"}
@@ -0,0 +1,2 @@
1
+ function t(t){if(0===t.length)throw new Error("Can't take random element of empty array");return t[Math.floor(Math.random()*t.length)]}export{t as default};
2
+ //# sourceMappingURL=randomArrayItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomArrayItem.js","sources":["../../../src/randomArrayItem.ts"],"sourcesContent":["export default function randomArrayItem<T>(arr: T[]): T {\n if (arr.length === 0) {\n throw new Error(\"Can't take random element of empty array\");\n }\n return arr[Math.floor(Math.random() * arr.length)];\n}\n"],"names":["randomArrayItem","arr","length","Error","Math","floor","random"],"mappings":"AAAc,SAAUA,EAAmBC,GACzC,GAAmB,IAAfA,EAAIC,OACN,MAAM,IAAIC,MAAM,4CAElB,OAAOF,EAAIG,KAAKC,MAAMD,KAAKE,SAAWL,EAAIC,QAC5C"}
@@ -0,0 +1,2 @@
1
+ function t(t,a){return Math.floor(Math.random()*(a-t)+t)}export{t as default};
2
+ //# sourceMappingURL=randomNum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomNum.js","sources":["../../../src/randomNum.ts"],"sourcesContent":["export default function randomNum(min: number, max: number): number {\n return Math.floor(Math.random() * (max - min) + min);\n}\n"],"names":["randomNum","min","max","Math","floor","random"],"mappings":"AAAc,SAAUA,EAAUC,EAAaC,GAC7C,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,GAAOA,EAClD"}
@@ -0,0 +1,2 @@
1
+ function r(r){try{return JSON.parse(r)}catch(t){return r}}export{r as default};
2
+ //# sourceMappingURL=safeJSONParse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeJSONParse.js","sources":["../../../src/safeJSONParse.ts"],"sourcesContent":["// safeJSONParse attempts to parse a JSON string, and if it fails returns the\n// original string instead of throwing an error\nexport default function safeJSONParse(text: string): any {\n try {\n return JSON.parse(text);\n } catch (_) {\n return text;\n }\n}\n"],"names":["safeJSONParse","text","JSON","parse","_"],"mappings":"AAEc,SAAUA,EAAcC,GACpC,IACE,OAAOC,KAAKC,MAAMF,EACpB,CAAE,MAAOG,GACP,OAAOH,CACT,CACF"}
@@ -0,0 +1,2 @@
1
+ const e=(t,...c)=>c.length?e(t=t.replace("$",c.shift()),...c):t;export{e as sprintf};
2
+ //# sourceMappingURL=sprintf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprintf.js","sources":["../../../src/sprintf.ts"],"sourcesContent":["const replaceToken = \"$\";\n\n// sprintf takes a string and replaces all instances of `replaceToken` with the provided arguments\nexport const sprintf = (str: string, ...argv: any[]): string => {\n if (!argv.length) return str;\n // eslint-disable-next-line no-return-assign, no-param-reassign\n return sprintf((str = str.replace(replaceToken, argv.shift())), ...argv);\n};\n"],"names":["sprintf","str","argv","length","replace","shift"],"mappings":"AAAA,MAGaA,EAAU,CAACC,KAAgBC,IACjCA,EAAKC,OAEHH,EAASC,EAAMA,EAAIG,QANP,IAM6BF,EAAKG,YAAcH,GAF1CD"}
@@ -0,0 +1,2 @@
1
+ function t(t){return t%10==1&&t%100!=11?`${t}st`:t%10==2&&t%100!=12?`${t}nd`:t%10==3&&t%100!=13?`${t}rd`:`${t}th`}export{t as default};
2
+ //# sourceMappingURL=toOrdinal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toOrdinal.js","sources":["../../../src/toOrdinal.ts"],"sourcesContent":["export default function toOrdinal(n: number): string {\n if (n % 10 === 1 && n % 100 !== 11) return `${n}st`;\n\n if (n % 10 === 2 && n % 100 !== 12) return `${n}nd`;\n\n if (n % 10 === 3 && n % 100 !== 13) return `${n}rd`;\n\n return `${n}th`;\n}\n"],"names":["toOrdinal","n"],"mappings":"AAAc,SAAUA,EAAUC,GAChC,OAAIA,EAAI,IAAO,GAAKA,EAAI,KAAQ,GAAW,GAAGA,MAE1CA,EAAI,IAAO,GAAKA,EAAI,KAAQ,GAAW,GAAGA,MAE1CA,EAAI,IAAO,GAAKA,EAAI,KAAQ,GAAW,GAAGA,MAEvC,GAAGA,KACZ"}
@@ -0,0 +1,2 @@
1
+ function t(...t){return t}export{t as default};
2
+ //# sourceMappingURL=tuplify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tuplify.js","sources":["../../../src/tuplify.ts"],"sourcesContent":["export default function tuplify<T extends any[]>(...elements: T) {\n return elements;\n}\n"],"names":["tuplify","elements"],"mappings":"AAAc,SAAUA,KAA4BC,GAClD,OAAOA,CACT"}
@@ -0,0 +1,2 @@
1
+ class t{constructor(t,e){this.href=t,this.as=null!=e?e:t}hrefPathname(t){const h=e(this.href);return t?`${h}/${t}`:h}asPathname(t){const h=e(this.as);return t?`${h}/${t}`:h}getQuery(){if("string"!=typeof this.href)return this.href.query}getHash(){var t;return"string"==typeof this.href?"":null!==(t=this.href.hash)&&void 0!==t?t:""}addStatic(e){return new t(this.hrefPathname(e),this.asPathname(e))}maybeAddStatic(e){return new t(this.hrefPathname(e),this.asPathname(e))}addDynamic(e,h,a=!1){const n=a?encodeURIComponent(h):h;return new t(this.hrefPathname(`[${e}]`),this.asPathname(n))}withQuery(e){const a=h(e);return new t({pathname:this.hrefPathname(),query:a,hash:this.getHash()},{pathname:this.asPathname(),query:a,hash:this.getHash()})}withHash(e){return new t({pathname:this.hrefPathname(),query:this.getQuery(),hash:e},{pathname:this.asPathname(),query:this.getQuery(),hash:e})}}function e(t){var e;return t?"string"==typeof t?t:null!==(e=t.pathname)&&void 0!==e?e:"":""}function h(t){return Object.keys(t).reduce(((e,h)=>{const a=t[h];return null!=a&&a.length>0?Object.assign(Object.assign({},e),{[h]:a}):e}),{})}export{t as Route,h as queryHandler};
2
+ //# sourceMappingURL=urlUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlUtils.js","sources":["../../../src/urlUtils.ts"],"sourcesContent":["import { ParsedUrlQueryInput } from \"querystring\";\nimport { UrlObject } from \"url\";\n\ntype Url = string | UrlObject;\n\nexport type LinkObject = {\n href: Url;\n as?: Url;\n};\n\n/**\n * __Route__\n *\n * `Route` class that handles adding static and dynamic route segments to\n * existing routes. `Route` can be initialized with a \"href\" string or\n * `UrlObject` and optional \"as\" string or `UrlObject`.\n *\n * @example\n * const routeA = new Route(\"/repositories\");\n * routeA.hrefPathname() // \"/repositories\"\n * routeA.addDynamic(\"ownerName\", \"my-owner\")\n * routeA.hrefPathname() // \"repositories/[ownerName]\"\n * routeA.asPathname() // \"repositories/my-owner\"\n *\n * const routeB = new Route(\n * { pathname: \"/repositories/[ownerName]\", query: { refName: \"main\" } },\n * { pathname: \"/repositories/my-owner\", query: { refName: \"main\" } },\n * )\n * routeB.hrefPathname() // \"/repositories/[ownerName]\"\n * routeB.asPathname() // \"repositories/my-owner\"\n * routeB.getQuery() // { refName: \"main\" }\n */\nexport class Route {\n href: Url;\n\n as: Url;\n\n constructor(href: Url, as?: Url) {\n this.href = href;\n this.as = as ?? href;\n }\n\n /**\n * __hrefPathname__\n *\n * Gets pathname string from href string or `UrlObject`.\n *\n * @param addFrag Optional route fragment string to add to `href` pathname\n *\n * @returns `href` pathname string, with added route fragment if provided\n *\n * @example\n * const routeA = new Route(\"/repositories\");\n * routeA.hrefPathname() // \"/repositories\"\n * routeA.hrefPathname(\"[ownerName]\") // \"repositories/[ownerName]\"\n *\n * const routeB = new Route({ pathname: \"/repositories\" })\n * routeB.hrefPathname() // \"/repositories\"\n * routeB.hrefPathname(\"[ownerName]\") // \"repositories/[ownerName]\"\n */\n hrefPathname(addFrag?: string): string {\n const href = getPathname(this.href);\n if (!addFrag) return href;\n return `${href}/${addFrag}`;\n }\n\n /**\n * __asPathname__\n *\n * Gets pathname string from as string or `UrlObject`.\n *\n * @param addFrag Optional route fragment string to add to `as` pathname\n *\n * @returns `as` pathname string, with added route fragment if provided\n *\n * @example\n * const routeA = new Route(\"/repositories\");\n * routeA.asPathname() // \"/repositories\"\n * routeA.asPathname(\"my-username\") // \"repositories/my-username\"\n *\n * const routeB = new Route(\n * { pathname: \"/repositories/[ownerName]\" },\n * { pathname: \"/repositories/my-username\" },\n * );\n * routeB.asPathname() // \"/repositories/my-username\"\n * routeB.asPathname(\"data\") // \"repositories/my-username/data\"\n */\n asPathname(addFrag?: string): string {\n const as = getPathname(this.as);\n if (!addFrag) return as;\n return `${as}/${addFrag}`;\n }\n\n /**\n * __getQuery__\n *\n * Gets query object from the href `UrlObject`.\n *\n * @returns query object\n *\n * @example\n * const route = new Route(\"/repositories\");\n * route.withQuery({ refName: \"main\" })\n * route.getQuery() // { refName: \"main\" }\n */\n getQuery(): string | ParsedUrlQueryInput | undefined | null {\n if (typeof this.href === \"string\") return undefined;\n return this.href.query;\n }\n\n /**\n * __getHash__\n *\n * Gets hash string from the href `UrlObject`.\n *\n * @returns hash string\n *\n * @example\n * const route = new Route(\"/repositories\");\n * route.withHash(\"commitA\")\n * route.getHash() // \"commitA\"\n */\n getHash(): string {\n if (typeof this.href === \"string\") return \"\";\n return this.href.hash ?? \"\";\n }\n\n /**\n * __addStatic__\n *\n * Adds static route fragment string to a `Route`. Static route fragments look like:\n * ```ts\n * { href: \"/repositories\", as: \"/repositories\" }\n * ```\n * As opposed to dynamic route fragments which look like:\n * ```ts\n * { href: \"/[ownerName]\", as: \"/owner-value\" }\n * ```\n *\n * @param pathFrag Route fragment string to add to the url. \"/\" is automatically prepended.\n *\n * @returns new instance of `Route`\n *\n * @example\n * const route = new Route(\"/repositories\");\n * route.addStatic(\"data\")\n * route.hrefPathname() // \"/repositories/data\"\n * route.asPathname() // \"/repositories/data\"\n */\n addStatic(pathFrag: string): Route {\n return new Route(this.hrefPathname(pathFrag), this.asPathname(pathFrag));\n }\n\n /**\n * __maybeAddStatic__\n *\n * Maybe adds static route fragment string to a `Route`.\n *\n * @see this.addStatic\n *\n * @param pathFrag Optional route fragment string to add to the url. \"/\" is automatically prepended.\n *\n * @example\n * const route = new Route(\"/repositories\");\n * route.maybeAddStatic(\"data\")\n * route.hrefPathname() // \"/repositories/data\"\n * route.maybeAddStatic()\n * route.hrefPathname() // \"/repositories\"\n */\n maybeAddStatic(pathFrag?: string): Route {\n return new Route(this.hrefPathname(pathFrag), this.asPathname(pathFrag));\n }\n\n /**\n * __addDynamic__\n *\n * Adds dynamic route fragment string to a Route.\n * Dynamic route fragments look like:\n * ```ts\n * { href: \"/[ownerName]\", as: \"/owner-value\" }\n * ```\n * As opposed to static route fragments which look like:\n *\n * ```ts\n * { href: \"/repositories\", as: \"/repositories\" }\n * ```\n *\n * @param param String fragment to add to the href path. This value will be wrapped in square brackets. \"/\" is automatically prepended.\n * @param as Value of the `param` to be added to the `as` path. \"/\" is automatically prepended.\n * @param encode Default false. If true, encodes a `as` param value string as a valid component of a Uniform Resource Identifier (URI).\n *\n * @returns new instance of `Route`\n *\n * @example\n * const route = new Route(\"/repositories\");\n * route.addDynamic(\"ownerName\", \"my-owner-name\")\n * route.hrefPathname() // \"/repositories/[ownerName]\"\n * route.asPathname() // \"/repositories/my-owner-name\"\n */\n addDynamic(param: string, as: string, encode = false): Route {\n const asStr = encode ? encodeURIComponent(as) : as;\n return new Route(this.hrefPathname(`[${param}]`), this.asPathname(asStr));\n }\n\n /**\n * __withQuery__\n *\n * Adds query object to a `Route`. Looks like \"?refName=main&active=Tables\"\n * when url is formatted.\n *\n * @param q Record with fields that will be added to the query string.\n *\n * @returns new instance of `Route`\n *\n * @example\n * const route = new Route(\"/repositories/[ownerName]\", \"/repositories/my-owner\");\n * route.withQuery({ refName: \"main\", active: undefined })\n * route.hrefPathname() // { pathname: \"/repositories/[ownerName]\", query: { refName: \"main\" } }\n * route.asPathname() // { pathname: \"/repositories/my-owner\", query: { refName: \"main\" } }\n */\n withQuery(q: Record<string, string | undefined | null>): Route {\n const query = queryHandler(q);\n return new Route(\n { pathname: this.hrefPathname(), query, hash: this.getHash() },\n { pathname: this.asPathname(), query, hash: this.getHash() },\n );\n }\n\n /**\n * __withHash__\n *\n * Adds hash string to a `Route`. Looks like \"#hash-value\" when url is formatted.\n *\n * @param hash Optional hash string\n *\n * @returns new instance of Route\n *\n * @example\n * const route = new Route(\"/repositories/[ownerName]\", \"/repositories/my-owner\");\n * route.withHash({ commitId: \"commitA\" })\n * route.hrefPathname() // { pathname: \"/repositories/[ownerName]\", hash: { commitId: \"commitA\" } }\n * route.asPathname() // { pathname: \"/repositories/my-owner\", hash: { commitId: \"commitA\" } }\n */\n withHash(hash?: string): Route {\n return new Route(\n { pathname: this.hrefPathname(), query: this.getQuery(), hash },\n { pathname: this.asPathname(), query: this.getQuery(), hash },\n );\n }\n}\n\n// Gets pathname from url string or object\nfunction getPathname(as?: string | UrlObject): string {\n if (!as) return \"\";\n if (typeof as === \"string\") return as;\n return as.pathname ?? \"\";\n}\n\n// Returns query object with undefined or empty values removed\nexport function queryHandler(\n q: Record<string, string | undefined | null>,\n): string | null | ParsedUrlQueryInput | undefined {\n return Object.keys(q).reduce((prev, key) => {\n const currVal = q[key];\n if (currVal !== undefined && currVal !== null && currVal.length > 0) {\n return { ...prev, [key]: currVal };\n }\n return prev;\n }, {} as NodeJS.Dict<string>);\n}\n"],"names":["Route","constructor","href","as","this","hrefPathname","addFrag","getPathname","asPathname","getQuery","query","getHash","_a","hash","addStatic","pathFrag","maybeAddStatic","addDynamic","param","encode","asStr","encodeURIComponent","withQuery","q","queryHandler","pathname","withHash","Object","keys","reduce","prev","key","currVal","length","assign"],"mappings":"MAgCaA,EAKX,WAAAC,CAAYC,EAAWC,GACrBC,KAAKF,KAAOA,EACZE,KAAKD,GAAKA,QAAAA,EAAMD,CAClB,CAoBA,YAAAG,CAAaC,GACX,MAAMJ,EAAOK,EAAYH,KAAKF,MAC9B,OAAKI,EACE,GAAGJ,KAAQI,IADGJ,CAEvB,CAuBA,UAAAM,CAAWF,GACT,MAAMH,EAAKI,EAAYH,KAAKD,IAC5B,OAAKG,EACE,GAAGH,KAAMG,IADKH,CAEvB,CAcA,QAAAM,GACE,GAAyB,iBAAdL,KAAKF,KAChB,OAAOE,KAAKF,KAAKQ,KACnB,CAcA,OAAAC,SACE,MAAyB,iBAAdP,KAAKF,KAA0B,GACrB,QAAdU,EAAAR,KAAKF,KAAKW,YAAI,IAAAD,EAAAA,EAAI,EAC3B,CAwBA,SAAAE,CAAUC,GACR,OAAO,IAAIf,EAAMI,KAAKC,aAAaU,GAAWX,KAAKI,WAAWO,GAChE,CAkBA,cAAAC,CAAeD,GACb,OAAO,IAAIf,EAAMI,KAAKC,aAAaU,GAAWX,KAAKI,WAAWO,GAChE,CA4BA,UAAAE,CAAWC,EAAef,EAAYgB,GAAS,GAC7C,MAAMC,EAAQD,EAASE,mBAAmBlB,GAAMA,EAChD,OAAO,IAAIH,EAAMI,KAAKC,aAAa,IAAIa,MAAWd,KAAKI,WAAWY,GACpE,CAkBA,SAAAE,CAAUC,GACR,MAAMb,EAAQc,EAAaD,GAC3B,OAAO,IAAIvB,EACT,CAAEyB,SAAUrB,KAAKC,eAAgBK,QAAOG,KAAMT,KAAKO,WACnD,CAAEc,SAAUrB,KAAKI,aAAcE,QAAOG,KAAMT,KAAKO,WAErD,CAiBA,QAAAe,CAASb,GACP,OAAO,IAAIb,EACT,CAAEyB,SAAUrB,KAAKC,eAAgBK,MAAON,KAAKK,WAAYI,QACzD,CAAEY,SAAUrB,KAAKI,aAAcE,MAAON,KAAKK,WAAYI,QAE3D,EAIF,SAASN,EAAYJ,SACnB,OAAKA,EACa,iBAAPA,EAAwBA,EACjB,UAAXA,EAAGsB,gBAAQ,IAAAb,EAAAA,EAAI,GAFN,EAGlB,CAGM,SAAUY,EACdD,GAEA,OAAOI,OAAOC,KAAKL,GAAGM,QAAO,CAACC,EAAMC,KAClC,MAAMC,EAAUT,EAAEQ,GAClB,OAAIC,SAA6CA,EAAQC,OAAS,EAChEN,OAAAO,OAAAP,OAAAO,OAAA,CAAA,EAAYJ,GAAI,CAAEC,CAACA,GAAMC,IAEpBF,CAAI,GACV,CAAA,EACL"}
@@ -0,0 +1,2 @@
1
+ const e=/\S+@\S+\.\S+/;function n(n){return{isValid:!!n.match(e),errorMsg:"Email format invalid"}}const a=/^[-a-z0-9_]{3,32}$/g,r=/^-|^_|-$|_$|--|__|-_|_-/;function t(e){return{isValid:!!e.match(a)&&!e.match(r),errorMsg:"Username can only contain lowercase letters, dashes, and underscores and be between 3 and 32 characters",detailedErrorMsg:s(e)}}function s(e){return e.length<3?"Username too short":e.length>32?"Username too long":e.toLowerCase()!==e?"Username cannot have uppercase letters":e.match(a)?e.match(r)?"Username invalid":"":"Username invalid"}export{n as emailValidator,t as usernameValidator};
2
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sources":["../../../src/validators.ts"],"sourcesContent":["const emailRegex = /\\S+@\\S+\\.\\S+/;\n\nexport function emailValidator(s: string) {\n return {\n isValid: !!s.match(emailRegex),\n errorMsg: \"Email format invalid\",\n };\n}\n\nconst usernameRegex = /^[-a-z0-9_]{3,32}$/g;\nconst invalidRegex = /^-|^_|-$|_$|--|__|-_|_-/;\n\nexport function usernameValidator(s: string) {\n return {\n isValid: !!s.match(usernameRegex) && !s.match(invalidRegex),\n errorMsg:\n \"Username can only contain lowercase letters, dashes, and underscores and be between 3 and 32 characters\",\n detailedErrorMsg: getUsernameErrorMsg(s),\n };\n}\n\nfunction getUsernameErrorMsg(s: string) {\n if (s.length < 3) {\n return \"Username too short\";\n }\n if (s.length > 32) {\n return \"Username too long\";\n }\n if (s.toLowerCase() !== s) {\n return \"Username cannot have uppercase letters\";\n }\n if (!s.match(usernameRegex)) {\n return \"Username invalid\";\n }\n if (s.match(invalidRegex)) {\n return \"Username invalid\";\n }\n return \"\";\n}\n"],"names":["emailRegex","emailValidator","s","isValid","match","errorMsg","usernameRegex","invalidRegex","usernameValidator","detailedErrorMsg","getUsernameErrorMsg","length","toLowerCase"],"mappings":"AAAA,MAAMA,EAAa,eAEb,SAAUC,EAAeC,GAC7B,MAAO,CACLC,UAAWD,EAAEE,MAAMJ,GACnBK,SAAU,uBAEd,CAEA,MAAMC,EAAgB,sBAChBC,EAAe,0BAEf,SAAUC,EAAkBN,GAChC,MAAO,CACLC,UAAWD,EAAEE,MAAME,KAAmBJ,EAAEE,MAAMG,GAC9CF,SACE,0GACFI,iBAAkBC,EAAoBR,GAE1C,CAEA,SAASQ,EAAoBR,GAC3B,OAAIA,EAAES,OAAS,EACN,qBAELT,EAAES,OAAS,GACN,oBAELT,EAAEU,gBAAkBV,EACf,yCAEJA,EAAEE,MAAME,GAGTJ,EAAEE,MAAMG,GACH,mBAEF,GALE,kBAMX"}
@@ -0,0 +1,3 @@
1
+ declare function excerpt(str: string, len?: number): string;
2
+
3
+ export { excerpt as default };
@@ -0,0 +1,3 @@
1
+ declare function fakeEscapePress(): void;
2
+
3
+ export { fakeEscapePress as default };
package/dist/index.d.ts CHANGED
@@ -1,431 +1,23 @@
1
- import { ColumnRef, Select } from 'node-sql-parser';
2
- import { ParsedUrlQueryInput } from 'querystring';
3
- import { UrlObject } from 'url';
4
-
5
- type Maybe<T> = T | undefined | null;
6
-
7
- declare function compareArray(arr1: string[], arr2: string[]): boolean;
8
-
9
- declare const oneHour: number;
10
- declare function getUTCDateAndTimeString(date: Date): string;
11
- declare function getDateString(date: Date): string;
12
- declare function getUTCDateString(date: Date): string;
13
- declare function getUTCTimeString(date: Date): string;
14
- declare function getNow(): Date;
15
- declare function getDateMinusHours(date: Date, hours: number): Date;
16
- declare function getUTCNowDateString(): string;
17
- declare function getLongDateTimeString(d: Date): string;
18
- declare function getTimeWithSeconds(date: Date): string;
19
- declare function getTimeAgoString(oldDateTime: number): string;
20
- declare function areTimeAgosEqual(a: Date, b: Date): boolean;
21
- declare function convertToUTCDate(d: Date): Date;
22
-
23
- declare function dedupe<T>(arr: T[]): T[];
24
-
25
- /**
26
- * enumKeys takes an enum and returns an array of strongly typed keys. Useful to iterate over string enums.
27
- * @param obj The enum
28
- * @returns An array of strong typed keys
29
- * @example
30
- *
31
- * enum MyEnum {
32
- * Key1 = "value1",
33
- * Key2 = "value2",
34
- * Key3 = "value3"
35
- * }
36
- *
37
- * // ks's type is ("Key1" || "Key2" || "Key3")[]
38
- * const ks = enumKeys(MyEnum);
39
- *
40
- * // keys' type is MyEnum[]
41
- * // Unfortunately, we can't do this inside enumKeys because there is no generic type constraint for enums.
42
- * const keys = ks.map(k => MyEnum[k])
43
- */
44
- declare function enumKeys<O extends object, K extends keyof O = keyof O>(obj: O): K[];
45
-
46
- declare function excerpt(str: string, len?: number): string;
47
-
48
- declare function fakeEscapePress(): void;
49
-
50
- declare function initialUppercase(s: string): string;
51
-
52
- declare enum KeyCodes {
53
- BACKSPACE = 8,
54
- TAB = 9,
55
- ENTER = 13,
56
- SHIFT = 16,
57
- CTRL = 17,
58
- ALT = 18,
59
- PAUSE = 19,
60
- CAPS_LOCK = 20,
61
- ESCAPE = 27,
62
- SPACE = 32,
63
- PAGE_UP = 33,
64
- PAGE_DOWN = 34,
65
- END = 35,
66
- HOME = 36,
67
- LEFT_ARROW = 37,
68
- UP_ARROW = 38,
69
- RIGHT_ARROW = 39,
70
- DOWN_ARROW = 40,
71
- INSERT = 45,
72
- DELETE = 46,
73
- KEY_0 = 48,
74
- KEY_1 = 49,
75
- KEY_2 = 50,
76
- KEY_3 = 51,
77
- KEY_4 = 52,
78
- KEY_5 = 53,
79
- KEY_6 = 54,
80
- KEY_7 = 55,
81
- KEY_8 = 56,
82
- KEY_9 = 57,
83
- KEY_A = 65,
84
- KEY_B = 66,
85
- KEY_C = 67,
86
- KEY_D = 68,
87
- KEY_E = 69,
88
- KEY_F = 70,
89
- KEY_G = 71,
90
- KEY_H = 72,
91
- KEY_I = 73,
92
- KEY_J = 74,
93
- KEY_K = 75,
94
- KEY_L = 76,
95
- KEY_M = 77,
96
- KEY_N = 78,
97
- KEY_O = 79,
98
- KEY_P = 80,
99
- KEY_Q = 81,
100
- KEY_R = 82,
101
- KEY_S = 83,
102
- KEY_T = 84,
103
- KEY_U = 85,
104
- KEY_V = 86,
105
- KEY_W = 87,
106
- KEY_X = 88,
107
- KEY_Y = 89,
108
- KEY_Z = 90,
109
- LEFT_META = 91,
110
- RIGHT_META = 92,
111
- SELECT = 93,
112
- NUMPAD_0 = 96,
113
- NUMPAD_1 = 97,
114
- NUMPAD_2 = 98,
115
- NUMPAD_3 = 99,
116
- NUMPAD_4 = 100,
117
- NUMPAD_5 = 101,
118
- NUMPAD_6 = 102,
119
- NUMPAD_7 = 103,
120
- NUMPAD_8 = 104,
121
- NUMPAD_9 = 105,
122
- MULTIPLY = 106,
123
- ADD = 107,
124
- SUBTRACT = 109,
125
- DECIMAL = 110,
126
- DIVIDE = 111,
127
- F1 = 112,
128
- F2 = 113,
129
- F3 = 114,
130
- F4 = 115,
131
- F5 = 116,
132
- F6 = 117,
133
- F7 = 118,
134
- F8 = 119,
135
- F9 = 120,
136
- F10 = 121,
137
- F11 = 122,
138
- F12 = 123,
139
- NUM_LOCK = 144,
140
- SCROLL_LOCK = 145,
141
- SEMICOLON = 186,
142
- EQUALS = 187,
143
- COMMA = 188,
144
- DASH = 189,
145
- PERIOD = 190,
146
- FORWARD_SLASH = 191,
147
- GRAVE_ACCENT = 192,
148
- OPEN_BRACKET = 219,
149
- BACK_SLASH = 220,
150
- CLOSE_BRACKET = 221,
151
- SINGLE_QUOTE = 222
152
- }
153
-
154
- declare const loremer: {
155
- word: ({ trueSingleWord, minLength, maxLength, matchRegex, }?: {
156
- trueSingleWord?: boolean;
157
- matchRegex?: RegExp;
158
- minLength?: number;
159
- maxLength?: number;
160
- }) => string;
161
- words: (n: number) => string[];
162
- resourceNameSegment: () => string;
163
- sentence: (options?: {
164
- max?: number;
165
- min?: number;
166
- }) => string;
167
- sentences: (n: number) => string[];
168
- paragraph: () => string;
169
- };
170
-
171
- declare function nTimes<T>(n: number, operation: (...args: any[]) => T, args?: Parameters<typeof operation>): T[];
172
- declare function nTimesWithIndex<T>(n: number, operation: (n: number) => T): T[];
173
-
174
- declare const NULL_VALUE = "\uF5F2\uEB94NULL\uF5A8\uE6FF";
175
- declare function isNullValue(dv: string): boolean;
176
- declare function getDisplayValue(dv: string): string;
177
- declare function getDisplayValueForApi(dv: string): string | null;
178
-
179
- declare function formatNumber(num: number): string;
180
- declare function formatToUsd(num: number): string;
181
- declare function formatToRoundedUsd(num: number): string;
182
-
183
- type TableColumn = {
184
- name: string;
185
- sourceTable?: Maybe<string>;
186
- };
187
- declare function parseSelectQuery(q: string): Select | null;
188
- declare function requireTableNameForSelect(q: string): string[];
189
- declare function getTableName(q?: string): Maybe<string>;
190
- type Column = {
191
- expr: ColumnRef;
192
- as: string | null;
193
- };
194
- type Columns = any[] | "*" | Column[];
195
- declare function getColumns(q: string): Columns | undefined;
196
- declare function convertToSqlWithNewColNames(q: string, cols: string[] | "*", tableName: string): string;
197
- declare function convertToSqlWithNewCols(q: string, cols: TableColumn[] | "*", tableNames?: string[]): string;
198
- declare function convertToSqlWithNewCondition(query: string, column: string, value: string): string;
199
- declare function convertToSqlWithOrderBy(query: string, column: string, type?: "ASC" | "DESC"): string;
200
- declare function queryHasOrderBy(query: string, column: string, type?: "ASC" | "DESC"): boolean;
201
- declare function isMutation(q?: string): boolean;
202
- declare function isReadQuery(q?: string): boolean;
203
- declare function removeColumnFromQuery(q: string, colNameToRemove: string, cols: TableColumn[]): string;
204
- declare function makeQueryExecutable(q: string): string;
205
- declare function isMultipleQueries(queryString: string): boolean;
206
-
207
- declare function pluralize(num: number, str: string): string;
208
-
209
- declare function prettyJSON(data: any): string;
210
- declare function prettyJSONText(text: string): string;
211
-
212
- declare function randomArrayItem<T>(arr: T[]): T;
213
-
214
- declare function randomNum(min: number, max: number): number;
215
-
216
- declare function safeJSONParse(text: string): any;
217
-
218
- declare const sprintf: (str: string, ...argv: any[]) => string;
219
-
220
- declare function toOrdinal(n: number): string;
221
-
222
- declare function tuplify<T extends any[]>(...elements: T): T;
223
-
224
- type Url = string | UrlObject;
225
- /**
226
- * __Route__
227
- *
228
- * `Route` class that handles adding static and dynamic route segments to
229
- * existing routes. `Route` can be initialized with a "href" string or
230
- * `UrlObject` and optional "as" string or `UrlObject`.
231
- *
232
- * @example
233
- * const routeA = new Route("/repositories");
234
- * routeA.hrefPathname() // "/repositories"
235
- * routeA.addDynamic("ownerName", "my-owner")
236
- * routeA.hrefPathname() // "repositories/[ownerName]"
237
- * routeA.asPathname() // "repositories/my-owner"
238
- *
239
- * const routeB = new Route(
240
- * { pathname: "/repositories/[ownerName]", query: { refName: "main" } },
241
- * { pathname: "/repositories/my-owner", query: { refName: "main" } },
242
- * )
243
- * routeB.hrefPathname() // "/repositories/[ownerName]"
244
- * routeB.asPathname() // "repositories/my-owner"
245
- * routeB.getQuery() // { refName: "main" }
246
- */
247
- declare class Route {
248
- href: Url;
249
- as: Url;
250
- constructor(href: Url, as?: Url);
251
- /**
252
- * __hrefPathname__
253
- *
254
- * Gets pathname string from href string or `UrlObject`.
255
- *
256
- * @param addFrag Optional route fragment string to add to `href` pathname
257
- *
258
- * @returns `href` pathname string, with added route fragment if provided
259
- *
260
- * @example
261
- * const routeA = new Route("/repositories");
262
- * routeA.hrefPathname() // "/repositories"
263
- * routeA.hrefPathname("[ownerName]") // "repositories/[ownerName]"
264
- *
265
- * const routeB = new Route({ pathname: "/repositories" })
266
- * routeB.hrefPathname() // "/repositories"
267
- * routeB.hrefPathname("[ownerName]") // "repositories/[ownerName]"
268
- */
269
- hrefPathname(addFrag?: string): string;
270
- /**
271
- * __asPathname__
272
- *
273
- * Gets pathname string from as string or `UrlObject`.
274
- *
275
- * @param addFrag Optional route fragment string to add to `as` pathname
276
- *
277
- * @returns `as` pathname string, with added route fragment if provided
278
- *
279
- * @example
280
- * const routeA = new Route("/repositories");
281
- * routeA.asPathname() // "/repositories"
282
- * routeA.asPathname("my-username") // "repositories/my-username"
283
- *
284
- * const routeB = new Route(
285
- * { pathname: "/repositories/[ownerName]" },
286
- * { pathname: "/repositories/my-username" },
287
- * );
288
- * routeB.asPathname() // "/repositories/my-username"
289
- * routeB.asPathname("data") // "repositories/my-username/data"
290
- */
291
- asPathname(addFrag?: string): string;
292
- /**
293
- * __getQuery__
294
- *
295
- * Gets query object from the href `UrlObject`.
296
- *
297
- * @returns query object
298
- *
299
- * @example
300
- * const route = new Route("/repositories");
301
- * route.withQuery({ refName: "main" })
302
- * route.getQuery() // { refName: "main" }
303
- */
304
- getQuery(): string | ParsedUrlQueryInput | undefined | null;
305
- /**
306
- * __getHash__
307
- *
308
- * Gets hash string from the href `UrlObject`.
309
- *
310
- * @returns hash string
311
- *
312
- * @example
313
- * const route = new Route("/repositories");
314
- * route.withHash("commitA")
315
- * route.getHash() // "commitA"
316
- */
317
- getHash(): string;
318
- /**
319
- * __addStatic__
320
- *
321
- * Adds static route fragment string to a `Route`. Static route fragments look like:
322
- * ```ts
323
- * { href: "/repositories", as: "/repositories" }
324
- * ```
325
- * As opposed to dynamic route fragments which look like:
326
- * ```ts
327
- * { href: "/[ownerName]", as: "/owner-value" }
328
- * ```
329
- *
330
- * @param pathFrag Route fragment string to add to the url. "/" is automatically prepended.
331
- *
332
- * @returns new instance of `Route`
333
- *
334
- * @example
335
- * const route = new Route("/repositories");
336
- * route.addStatic("data")
337
- * route.hrefPathname() // "/repositories/data"
338
- * route.asPathname() // "/repositories/data"
339
- */
340
- addStatic(pathFrag: string): Route;
341
- /**
342
- * __maybeAddStatic__
343
- *
344
- * Maybe adds static route fragment string to a `Route`.
345
- *
346
- * @see this.addStatic
347
- *
348
- * @param pathFrag Optional route fragment string to add to the url. "/" is automatically prepended.
349
- *
350
- * @example
351
- * const route = new Route("/repositories");
352
- * route.maybeAddStatic("data")
353
- * route.hrefPathname() // "/repositories/data"
354
- * route.maybeAddStatic()
355
- * route.hrefPathname() // "/repositories"
356
- */
357
- maybeAddStatic(pathFrag?: string): Route;
358
- /**
359
- * __addDynamic__
360
- *
361
- * Adds dynamic route fragment string to a Route.
362
- * Dynamic route fragments look like:
363
- * ```ts
364
- * { href: "/[ownerName]", as: "/owner-value" }
365
- * ```
366
- * As opposed to static route fragments which look like:
367
- *
368
- * ```ts
369
- * { href: "/repositories", as: "/repositories" }
370
- * ```
371
- *
372
- * @param param String fragment to add to the href path. This value will be wrapped in square brackets. "/" is automatically prepended.
373
- * @param as Value of the `param` to be added to the `as` path. "/" is automatically prepended.
374
- * @param encode Default false. If true, encodes a `as` param value string as a valid component of a Uniform Resource Identifier (URI).
375
- *
376
- * @returns new instance of `Route`
377
- *
378
- * @example
379
- * const route = new Route("/repositories");
380
- * route.addDynamic("ownerName", "my-owner-name")
381
- * route.hrefPathname() // "/repositories/[ownerName]"
382
- * route.asPathname() // "/repositories/my-owner-name"
383
- */
384
- addDynamic(param: string, as: string, encode?: boolean): Route;
385
- /**
386
- * __withQuery__
387
- *
388
- * Adds query object to a `Route`. Looks like "?refName=main&active=Tables"
389
- * when url is formatted.
390
- *
391
- * @param q Record with fields that will be added to the query string.
392
- *
393
- * @returns new instance of `Route`
394
- *
395
- * @example
396
- * const route = new Route("/repositories/[ownerName]", "/repositories/my-owner");
397
- * route.withQuery({ refName: "main", active: undefined })
398
- * route.hrefPathname() // { pathname: "/repositories/[ownerName]", query: { refName: "main" } }
399
- * route.asPathname() // { pathname: "/repositories/my-owner", query: { refName: "main" } }
400
- */
401
- withQuery(q: Record<string, string | undefined | null>): Route;
402
- /**
403
- * __withHash__
404
- *
405
- * Adds hash string to a `Route`. Looks like "#hash-value" when url is formatted.
406
- *
407
- * @param hash Optional hash string
408
- *
409
- * @returns new instance of Route
410
- *
411
- * @example
412
- * const route = new Route("/repositories/[ownerName]", "/repositories/my-owner");
413
- * route.withHash({ commitId: "commitA" })
414
- * route.hrefPathname() // { pathname: "/repositories/[ownerName]", hash: { commitId: "commitA" } }
415
- * route.asPathname() // { pathname: "/repositories/my-owner", hash: { commitId: "commitA" } }
416
- */
417
- withHash(hash?: string): Route;
418
- }
419
-
420
- declare function emailValidator(s: string): {
421
- isValid: boolean;
422
- errorMsg: string;
423
- };
424
- declare function usernameValidator(s: string): {
425
- isValid: boolean;
426
- errorMsg: string;
427
- detailedErrorMsg: string;
428
- };
429
-
430
- export { KeyCodes, NULL_VALUE, Route, areTimeAgosEqual, compareArray, convertToSqlWithNewColNames, convertToSqlWithNewCols, convertToSqlWithNewCondition, convertToSqlWithOrderBy, convertToUTCDate, dedupe, emailValidator, enumKeys, excerpt, fakeEscapePress, formatNumber, formatToRoundedUsd, formatToUsd, getColumns, getDateMinusHours, getDateString, getDisplayValue, getDisplayValueForApi, getLongDateTimeString, getNow, getTableName, getTimeAgoString, getTimeWithSeconds, getUTCDateAndTimeString, getUTCDateString, getUTCNowDateString, getUTCTimeString, initialUppercase, isMultipleQueries, isMutation, isNullValue, isReadQuery, loremer, makeQueryExecutable, nTimes, nTimesWithIndex, oneHour, parseSelectQuery, pluralize, prettyJSON, prettyJSONText, queryHasOrderBy, randomArrayItem, randomNum, removeColumnFromQuery, requireTableNameForSelect, safeJSONParse, sprintf, toOrdinal, tuplify, usernameValidator };
431
- export type { Maybe };
1
+ export { default as Maybe } from './Maybe.d.js';
2
+ export { default as compareArray } from './compareArray.d.js';
3
+ export { areTimeAgosEqual, convertToUTCDate, getDateMinusHours, getDateString, getLongDateTimeString, getNow, getTimeAgoString, getTimeWithSeconds, getUTCDateAndTimeString, getUTCDateString, getUTCNowDateString, getUTCTimeString, oneHour } from './dateConversions.d.js';
4
+ export { default as dedupe } from './dedupe.d.js';
5
+ export { default as enumKeys } from './enumKeys.d.js';
6
+ export { default as excerpt } from './excerpt.d.js';
7
+ export { default as fakeEscapePress } from './fakeEscapePress.d.js';
8
+ export { default as initialUppercase } from './initialUppercase.d.js';
9
+ export { KeyCodes } from './keycodes.d.js';
10
+ export { loremer } from './loremer/index.d.js';
11
+ export { default as nTimes, nTimesWithIndex } from './nTimes.d.js';
12
+ export { NULL_VALUE, getDisplayValue, getDisplayValueForApi, isNullValue } from './null.d.js';
13
+ export { formatNumber, formatToRoundedUsd, formatToUsd } from './numberFormat.d.js';
14
+ export { default as pluralize } from './pluralize.d.js';
15
+ export { default as prettyJSON, prettyJSONText } from './prettyJSON.d.js';
16
+ export { default as randomArrayItem } from './randomArrayItem.d.js';
17
+ export { default as randomNum } from './randomNum.d.js';
18
+ export { default as safeJSONParse } from './safeJSONParse.d.js';
19
+ export { sprintf } from './sprintf.d.js';
20
+ export { default as toOrdinal } from './toOrdinal.d.js';
21
+ export { default as tuplify } from './tuplify.d.js';
22
+ export { Route } from './urlUtils.d.js';
23
+ export { emailValidator, usernameValidator } from './validators.d.js';
@@ -0,0 +1,3 @@
1
+ declare function initialUppercase(s: string): string;
2
+
3
+ export { initialUppercase as default };