@koine/utils 1.0.26 → 1.0.29

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 (345) hide show
  1. package/{async.d.ts → Defer.d.ts} +5 -5
  2. package/{async.js → Defer.js} +2 -7
  3. package/{emitter.d.ts → Emitter.d.ts} +1 -0
  4. package/{emitter.js → Emitter.js} +1 -0
  5. package/accentSets.d.ts +16 -0
  6. package/accentSets.js +38 -0
  7. package/addOrReplaceAtIdx.d.ts +5 -0
  8. package/addOrReplaceAtIdx.js +19 -0
  9. package/arrayToLookup.d.ts +7 -0
  10. package/arrayToLookup.js +13 -0
  11. package/buildUrlQueryString.d.ts +12 -0
  12. package/buildUrlQueryString.js +24 -0
  13. package/changeUrlPath.d.ts +10 -0
  14. package/changeUrlPath.js +18 -0
  15. package/chunkByChunks.d.ts +7 -0
  16. package/chunkByChunks.js +37 -0
  17. package/chunkBySize.d.ts +6 -0
  18. package/chunkBySize.js +12 -0
  19. package/clamp.d.ts +8 -0
  20. package/clamp.js +10 -0
  21. package/clsx.d.ts +9 -0
  22. package/clsx.js +49 -0
  23. package/convertRange.d.ts +14 -0
  24. package/convertRange.js +16 -0
  25. package/cookie.d.ts +7 -26
  26. package/cookie.js +3 -221
  27. package/decode.d.ts +6 -0
  28. package/decode.js +10 -0
  29. package/encode.d.ts +6 -0
  30. package/encode.js +10 -0
  31. package/{cast.d.ts → ensureInt.d.ts} +3 -1
  32. package/{cast.js → ensureInt.js} +3 -4
  33. package/findDuplicatedIndexes.d.ts +5 -0
  34. package/findDuplicatedIndexes.js +14 -0
  35. package/getKeys.d.ts +9 -0
  36. package/getKeys.js +9 -0
  37. package/getNonce.d.ts +6 -0
  38. package/getNonce.js +9 -0
  39. package/getType.d.ts +22 -0
  40. package/getType.js +19 -0
  41. package/getUrlHashParams.d.ts +9 -0
  42. package/getUrlHashParams.js +16 -0
  43. package/getUrlHashPathname.d.ts +9 -0
  44. package/getUrlHashPathname.js +13 -0
  45. package/getUrlPathnameParts.d.ts +12 -0
  46. package/getUrlPathnameParts.js +20 -0
  47. package/getUrlQueryParams.d.ts +14 -0
  48. package/getUrlQueryParams.js +38 -0
  49. package/index.d.ts +107 -15
  50. package/index.js +108 -16
  51. package/isAnyObject.d.ts +8 -0
  52. package/isAnyObject.js +10 -0
  53. package/isArray.d.ts +7 -0
  54. package/isArray.js +10 -0
  55. package/isBlob.d.ts +7 -0
  56. package/isBlob.js +10 -0
  57. package/isBoolean.d.ts +7 -0
  58. package/isBoolean.js +10 -0
  59. package/isBrowser.d.ts +6 -0
  60. package/{ssr.js → isBrowser.js} +5 -2
  61. package/isDate.d.ts +7 -0
  62. package/isDate.js +10 -0
  63. package/isEmptyArray.d.ts +7 -0
  64. package/isEmptyArray.js +10 -0
  65. package/isEmptyObject.d.ts +9 -0
  66. package/isEmptyObject.js +10 -0
  67. package/isEmptyString.d.ts +7 -0
  68. package/isEmptyString.js +9 -0
  69. package/isError.d.ts +7 -0
  70. package/isError.js +10 -0
  71. package/isExternalUrl.d.ts +9 -0
  72. package/isExternalUrl.js +21 -0
  73. package/isFile.d.ts +7 -0
  74. package/isFile.js +10 -0
  75. package/isFloat.d.ts +7 -0
  76. package/isFloat.js +10 -0
  77. package/isFormData.d.ts +7 -0
  78. package/isFormData.js +10 -0
  79. package/isFullArray.d.ts +7 -0
  80. package/isFullArray.js +10 -0
  81. package/isFullObject.d.ts +8 -0
  82. package/isFullObject.js +10 -0
  83. package/isFullString.d.ts +7 -0
  84. package/isFullString.js +10 -0
  85. package/isFunction.d.ts +8 -0
  86. package/isFunction.js +9 -0
  87. package/{detect.d.ts → isIE.d.ts} +3 -4
  88. package/isIE.js +18 -0
  89. package/isInt.d.ts +7 -0
  90. package/isInt.js +10 -0
  91. package/isMap.d.ts +7 -0
  92. package/isMap.js +10 -0
  93. package/isMobile.d.ts +7 -0
  94. package/{detect.js → isMobile.js} +4 -15
  95. package/isNaNValue.d.ts +7 -0
  96. package/isNaNValue.js +10 -0
  97. package/isNegativeNumber.d.ts +7 -0
  98. package/isNegativeNumber.js +10 -0
  99. package/isNull.d.ts +7 -0
  100. package/isNull.js +10 -0
  101. package/isNullOrUndefined.d.ts +7 -0
  102. package/isNullOrUndefined.js +10 -0
  103. package/isNumber.d.ts +9 -0
  104. package/isNumber.js +12 -0
  105. package/isObject.d.ts +8 -0
  106. package/isObject.js +10 -0
  107. package/isObjectLike.d.ts +10 -0
  108. package/isObjectLike.js +12 -0
  109. package/isOneOf.d.ts +9 -0
  110. package/isOneOf.js +10 -0
  111. package/isPlainObject.d.ts +8 -0
  112. package/isPlainObject.js +13 -0
  113. package/isPositiveNumber.d.ts +7 -0
  114. package/isPositiveNumber.js +10 -0
  115. package/isPrimitive.d.ts +7 -0
  116. package/isPrimitive.js +20 -0
  117. package/isPromise.d.ts +7 -0
  118. package/isPromise.js +10 -0
  119. package/isRegExp.d.ts +7 -0
  120. package/isRegExp.js +10 -0
  121. package/isServer.d.ts +6 -0
  122. package/isServer.js +8 -0
  123. package/isSet.d.ts +7 -0
  124. package/isSet.js +10 -0
  125. package/isString.d.ts +7 -0
  126. package/isString.js +10 -0
  127. package/isSymbol.d.ts +7 -0
  128. package/isSymbol.js +10 -0
  129. package/isType.d.ts +11 -0
  130. package/isType.js +22 -0
  131. package/isUndefined.d.ts +7 -0
  132. package/isUndefined.js +10 -0
  133. package/isWeakMap.d.ts +7 -0
  134. package/isWeakMap.js +10 -0
  135. package/isWeakSet.d.ts +7 -0
  136. package/isWeakSet.js +10 -0
  137. package/location.d.ts +2 -145
  138. package/location.js +1 -299
  139. package/mapListBy.d.ts +7 -0
  140. package/mapListBy.js +14 -0
  141. package/{match-sorter.d.ts → matchSorter.d.ts} +1 -0
  142. package/{match-sorter.js → matchSorter.js} +2 -1
  143. package/mergeObjects.d.ts +7 -0
  144. package/{objects.js → mergeObjects.js} +2 -31
  145. package/mergeUrlQueryParams.d.ts +9 -0
  146. package/mergeUrlQueryParams.js +22 -0
  147. package/navigateToHashParams.d.ts +9 -0
  148. package/navigateToHashParams.js +22 -0
  149. package/navigateToMergedHashParams.d.ts +8 -0
  150. package/navigateToMergedHashParams.js +14 -0
  151. package/navigateToMergedParams.d.ts +9 -0
  152. package/navigateToMergedParams.js +14 -0
  153. package/navigateToParams.d.ts +10 -0
  154. package/navigateToParams.js +18 -0
  155. package/navigateWithoutUrlParam.d.ts +8 -0
  156. package/navigateWithoutUrlParam.js +19 -0
  157. package/node/{async.js → Defer.js} +3 -9
  158. package/node/{emitter.js → Emitter.js} +1 -0
  159. package/node/accentSets.js +41 -0
  160. package/node/addOrReplaceAtIdx.js +23 -0
  161. package/node/arrayToLookup.js +17 -0
  162. package/node/buildUrlQueryString.js +28 -0
  163. package/node/changeUrlPath.js +22 -0
  164. package/node/chunkByChunks.js +41 -0
  165. package/node/chunkBySize.js +16 -0
  166. package/node/clamp.js +14 -0
  167. package/node/clsx.js +53 -0
  168. package/node/convertRange.js +20 -0
  169. package/node/cookie.js +4 -227
  170. package/node/decode.js +14 -0
  171. package/node/encode.js +14 -0
  172. package/node/{cast.js → ensureInt.js} +4 -6
  173. package/node/findDuplicatedIndexes.js +18 -0
  174. package/node/getKeys.js +12 -0
  175. package/node/getNonce.js +13 -0
  176. package/node/getType.js +23 -0
  177. package/node/getUrlHashParams.js +20 -0
  178. package/node/getUrlHashPathname.js +17 -0
  179. package/node/getUrlPathnameParts.js +24 -0
  180. package/node/getUrlQueryParams.js +42 -0
  181. package/node/index.js +108 -16
  182. package/node/isAnyObject.js +14 -0
  183. package/node/isArray.js +14 -0
  184. package/node/isBlob.js +14 -0
  185. package/node/isBoolean.js +14 -0
  186. package/node/{ssr.js → isBrowser.js} +6 -3
  187. package/node/isDate.js +14 -0
  188. package/node/isEmptyArray.js +14 -0
  189. package/node/isEmptyObject.js +14 -0
  190. package/node/isEmptyString.js +13 -0
  191. package/node/isError.js +14 -0
  192. package/node/isExternalUrl.js +25 -0
  193. package/node/isFile.js +14 -0
  194. package/node/isFloat.js +14 -0
  195. package/node/isFormData.js +14 -0
  196. package/node/isFullArray.js +14 -0
  197. package/node/isFullObject.js +14 -0
  198. package/node/isFullString.js +14 -0
  199. package/node/isFunction.js +13 -0
  200. package/node/isIE.js +22 -0
  201. package/node/isInt.js +14 -0
  202. package/node/isMap.js +14 -0
  203. package/node/{detect.js → isMobile.js} +6 -18
  204. package/node/isNaNValue.js +14 -0
  205. package/node/isNegativeNumber.js +14 -0
  206. package/node/isNull.js +14 -0
  207. package/node/isNullOrUndefined.js +13 -0
  208. package/node/isNumber.js +16 -0
  209. package/node/isObject.js +14 -0
  210. package/node/isObjectLike.js +16 -0
  211. package/node/isOneOf.js +14 -0
  212. package/node/isPlainObject.js +17 -0
  213. package/node/isPositiveNumber.js +14 -0
  214. package/node/isPrimitive.js +24 -0
  215. package/node/isPromise.js +14 -0
  216. package/node/isRegExp.js +14 -0
  217. package/node/isServer.js +11 -0
  218. package/node/isSet.js +14 -0
  219. package/node/isString.js +14 -0
  220. package/node/isSymbol.js +14 -0
  221. package/node/isType.js +26 -0
  222. package/node/isUndefined.js +14 -0
  223. package/node/isWeakMap.js +14 -0
  224. package/node/isWeakSet.js +14 -0
  225. package/node/location.js +0 -321
  226. package/node/mapListBy.js +18 -0
  227. package/node/{match-sorter.js → matchSorter.js} +3 -2
  228. package/node/{objects.js → mergeObjects.js} +5 -36
  229. package/node/mergeUrlQueryParams.js +26 -0
  230. package/node/navigateToHashParams.js +26 -0
  231. package/node/navigateToMergedHashParams.js +18 -0
  232. package/node/navigateToMergedParams.js +18 -0
  233. package/node/navigateToParams.js +22 -0
  234. package/node/navigateWithoutUrlParam.js +23 -0
  235. package/node/normaliseUrl.js +18 -0
  236. package/node/normaliseUrlPathname.js +18 -0
  237. package/node/{analytics-google.js → pageview.js} +12 -10
  238. package/node/parseCookie.js +52 -0
  239. package/node/parseURL.js +24 -0
  240. package/node/randomInt.js +13 -0
  241. package/node/{misc.js → randomKey.js} +2 -0
  242. package/node/readCookie.js +38 -0
  243. package/node/redirectTo.js +19 -0
  244. package/node/removeAccents.js +19 -0
  245. package/node/removeCookie.js +19 -0
  246. package/node/removeDuplicatesByKey.js +25 -0
  247. package/node/removeDuplicatesComparing.js +14 -0
  248. package/node/removeIndexesFromArray.js +18 -0
  249. package/node/removeTrailingSlash.js +14 -0
  250. package/node/{math.js → roundTo.js} +3 -32
  251. package/node/serializeCookie.js +108 -0
  252. package/node/setCookie.js +61 -0
  253. package/node/shuffle.js +36 -0
  254. package/node/slugify.js +27 -0
  255. package/node/swapMap.js +18 -0
  256. package/node/{typography.js → titleCase.js} +3 -12
  257. package/node/toNumber.js +12 -0
  258. package/node/{colors.js → toRgba.js} +4 -0
  259. package/node/transformToUrlPathname.js +20 -0
  260. package/node/truncate.js +17 -0
  261. package/node/uid.js +4 -13
  262. package/node/updateLinkParams.js +18 -0
  263. package/node/updateUrlQueryParams.js +22 -0
  264. package/node/uuid.js +17 -0
  265. package/node/wait.js +13 -0
  266. package/node/whitelistObject.js +19 -0
  267. package/normaliseUrl.d.ts +10 -0
  268. package/normaliseUrl.js +14 -0
  269. package/normaliseUrlPathname.d.ts +10 -0
  270. package/normaliseUrlPathname.js +14 -0
  271. package/package.json +1 -1
  272. package/{analytics-google.d.ts → pageview.d.ts} +3 -0
  273. package/{analytics-google.js → pageview.js} +12 -10
  274. package/parseCookie.d.ts +11 -0
  275. package/parseCookie.js +48 -0
  276. package/parseURL.d.ts +17 -0
  277. package/parseURL.js +20 -0
  278. package/randomInt.d.ts +7 -0
  279. package/randomInt.js +9 -0
  280. package/{misc.d.ts → randomKey.d.ts} +2 -0
  281. package/{misc.js → randomKey.js} +2 -0
  282. package/readCookie.d.ts +3 -0
  283. package/readCookie.js +34 -0
  284. package/redirectTo.d.ts +9 -0
  285. package/redirectTo.js +15 -0
  286. package/removeAccents.d.ts +6 -0
  287. package/removeAccents.js +15 -0
  288. package/removeCookie.d.ts +10 -0
  289. package/removeCookie.js +15 -0
  290. package/removeDuplicatesByKey.d.ts +8 -0
  291. package/removeDuplicatesByKey.js +21 -0
  292. package/removeDuplicatesComparing.d.ts +5 -0
  293. package/removeDuplicatesComparing.js +10 -0
  294. package/removeIndexesFromArray.d.ts +5 -0
  295. package/removeIndexesFromArray.js +14 -0
  296. package/removeTrailingSlash.d.ts +7 -0
  297. package/removeTrailingSlash.js +10 -0
  298. package/roundTo.d.ts +8 -0
  299. package/{math.js → roundTo.js} +2 -28
  300. package/serializeCookie.d.ts +27 -0
  301. package/serializeCookie.js +104 -0
  302. package/setCookie.d.ts +10 -0
  303. package/setCookie.js +57 -0
  304. package/shuffle.d.ts +16 -0
  305. package/shuffle.js +32 -0
  306. package/{text.d.ts → slugify.d.ts} +2 -5
  307. package/slugify.js +23 -0
  308. package/swapMap.d.ts +7 -0
  309. package/swapMap.js +14 -0
  310. package/{typography.d.ts → titleCase.d.ts} +2 -4
  311. package/{typography.js → titleCase.js} +2 -10
  312. package/toNumber.d.ts +5 -0
  313. package/toNumber.js +8 -0
  314. package/{colors.d.ts → toRgba.d.ts} +4 -0
  315. package/{colors.js → toRgba.js} +4 -0
  316. package/transformToUrlPathname.d.ts +11 -0
  317. package/transformToUrlPathname.js +16 -0
  318. package/truncate.d.ts +7 -0
  319. package/truncate.js +13 -0
  320. package/uid.d.ts +3 -6
  321. package/uid.js +3 -11
  322. package/updateLinkParams.d.ts +10 -0
  323. package/updateLinkParams.js +14 -0
  324. package/updateUrlQueryParams.d.ts +9 -0
  325. package/updateUrlQueryParams.js +18 -0
  326. package/uuid.d.ts +8 -0
  327. package/uuid.js +13 -0
  328. package/wait.d.ts +7 -0
  329. package/wait.js +9 -0
  330. package/whitelistObject.d.ts +8 -0
  331. package/whitelistObject.js +15 -0
  332. package/arrays.d.ts +0 -41
  333. package/arrays.js +0 -153
  334. package/is.d.ts +0 -288
  335. package/is.js +0 -376
  336. package/math.d.ts +0 -28
  337. package/node/arrays.js +0 -166
  338. package/node/is.js +0 -417
  339. package/node/security.js +0 -29
  340. package/node/text.js +0 -70
  341. package/objects.d.ts +0 -22
  342. package/security.d.ts +0 -12
  343. package/security.js +0 -23
  344. package/ssr.d.ts +0 -2
  345. package/text.js +0 -65
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isIE = exports.isMobile = void 0;
4
- var ssr_1 = require("./ssr");
3
+ exports.isMobile = void 0;
4
+ var isServer_1 = require("./isServer");
5
5
  /**
6
+ * @category detect
7
+ * @category is
6
8
  * @see https://stackoverflow.com/a/3540295
7
9
  */
8
10
  function isMobile(ssrValue) {
9
11
  if (ssrValue === void 0) { ssrValue = true; }
10
- if (ssr_1.isServer) {
12
+ if (isServer_1.isServer) {
11
13
  return ssrValue;
12
14
  }
13
15
  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent);
@@ -15,18 +17,4 @@ function isMobile(ssrValue) {
15
17
  // || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4)
16
18
  }
17
19
  exports.isMobile = isMobile;
18
- /**
19
- * @see https://stackoverflow.com/a/21712356/12285349
20
- */
21
- function isIE(ssrValue) {
22
- if (ssrValue === void 0) { ssrValue = true; }
23
- if (ssr_1.isServer) {
24
- return ssrValue;
25
- }
26
- var ua = window.navigator.userAgent;
27
- if (ua.indexOf("MSIE ") > 0 || ua.indexOf("Trident/") > 0) {
28
- return true;
29
- }
30
- return false;
31
- }
32
- exports.isIE = isIE;
20
+ exports.default = isMobile;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNaNValue = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is literally the value `NaN` (it's `NaN` and also a `number`)
7
+ *
8
+ * @category is
9
+ */
10
+ function isNaNValue(payload) {
11
+ return (0, getType_1.default)(payload) === "Number" && isNaN(payload);
12
+ }
13
+ exports.isNaNValue = isNaNValue;
14
+ exports.default = isNaNValue;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNegativeNumber = void 0;
4
+ var isNumber_1 = require("./isNumber");
5
+ /**
6
+ * Returns whether the payload is a negative number (but not 0)
7
+ *
8
+ * @category is
9
+ */
10
+ function isNegativeNumber(payload) {
11
+ return (0, isNumber_1.default)(payload) && payload < 0;
12
+ }
13
+ exports.isNegativeNumber = isNegativeNumber;
14
+ exports.default = isNegativeNumber;
package/node/isNull.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNull = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is null
7
+ *
8
+ * @category is
9
+ */
10
+ function isNull(payload) {
11
+ return (0, getType_1.default)(payload) === "Null";
12
+ }
13
+ exports.isNull = isNull;
14
+ exports.default = isNull;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNullOrUndefined = void 0;
4
+ var isNull_1 = require("./isNull");
5
+ var isOneOf_1 = require("./isOneOf");
6
+ var isUndefined_1 = require("./isUndefined");
7
+ /**
8
+ * Returns true whether the payload is null or undefined
9
+ *
10
+ * @category is
11
+ */
12
+ exports.isNullOrUndefined = (0, isOneOf_1.default)(isNull_1.default, isUndefined_1.default);
13
+ exports.default = exports.isNullOrUndefined;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNumber = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a number (but not NaN)
7
+ *
8
+ * This will return `false` for `NaN`!!
9
+ *
10
+ * @category is
11
+ */
12
+ function isNumber(payload) {
13
+ return (0, getType_1.default)(payload) === "Number" && !isNaN(payload);
14
+ }
15
+ exports.isNumber = isNumber;
16
+ exports.default = isNumber;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isObject = void 0;
4
+ var isPlainObject_1 = require("./isPlainObject");
5
+ /**
6
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
7
+ *
8
+ * @category is
9
+ */
10
+ function isObject(payload) {
11
+ return (0, isPlainObject_1.default)(payload);
12
+ }
13
+ exports.isObject = isObject;
14
+ exports.default = isObject;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isObjectLike = void 0;
4
+ var isAnyObject_1 = require("./isAnyObject");
5
+ /**
6
+ * Returns whether the payload is an object like a type passed in < >
7
+ *
8
+ * Usage: isObjectLike<{id: any}>(payload) // will make sure it's an object and has an `id` prop.
9
+ *
10
+ * @category is
11
+ */
12
+ function isObjectLike(payload) {
13
+ return (0, isAnyObject_1.default)(payload);
14
+ }
15
+ exports.isObjectLike = isObjectLike;
16
+ exports.default = isObjectLike;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOneOf = void 0;
4
+ function isOneOf(a, b, c, d, e) {
5
+ return function (value) {
6
+ return a(value) ||
7
+ b(value) ||
8
+ (!!c && c(value)) ||
9
+ (!!d && d(value)) ||
10
+ (!!e && e(value));
11
+ };
12
+ }
13
+ exports.isOneOf = isOneOf;
14
+ exports.default = isOneOf;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPlainObject = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
7
+ *
8
+ * @category is
9
+ */
10
+ function isPlainObject(payload) {
11
+ if ((0, getType_1.default)(payload) !== "Object")
12
+ return false;
13
+ return (payload.constructor === Object &&
14
+ Object.getPrototypeOf(payload) === Object.prototype);
15
+ }
16
+ exports.isPlainObject = isPlainObject;
17
+ exports.default = isPlainObject;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPositiveNumber = void 0;
4
+ var isNumber_1 = require("./isNumber");
5
+ /**
6
+ * Returns whether the payload is a positive number (but not 0)
7
+ *
8
+ * @category is
9
+ */
10
+ function isPositiveNumber(payload) {
11
+ return (0, isNumber_1.default)(payload) && payload > 0;
12
+ }
13
+ exports.isPositiveNumber = isPositiveNumber;
14
+ exports.default = isPositiveNumber;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPrimitive = void 0;
4
+ var isString_1 = require("./isString");
5
+ var isNull_1 = require("./isNull");
6
+ var isNumber_1 = require("./isNumber");
7
+ var isUndefined_1 = require("./isUndefined");
8
+ var isBoolean_1 = require("./isBoolean");
9
+ var isSymbol_1 = require("./isSymbol");
10
+ /**
11
+ * Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)
12
+ *
13
+ * @category is
14
+ */
15
+ function isPrimitive(payload) {
16
+ return ((0, isBoolean_1.default)(payload) ||
17
+ (0, isNull_1.default)(payload) ||
18
+ (0, isUndefined_1.default)(payload) ||
19
+ (0, isNumber_1.default)(payload) ||
20
+ (0, isString_1.default)(payload) ||
21
+ (0, isSymbol_1.default)(payload));
22
+ }
23
+ exports.isPrimitive = isPrimitive;
24
+ exports.default = isPrimitive;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPromise = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a Promise
7
+ *
8
+ * @category is
9
+ */
10
+ function isPromise(payload) {
11
+ return (0, getType_1.default)(payload) === "Promise";
12
+ }
13
+ exports.isPromise = isPromise;
14
+ exports.default = isPromise;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRegExp = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a regular expression (RegExp)
7
+ *
8
+ * @category is
9
+ */
10
+ function isRegExp(payload) {
11
+ return (0, getType_1.default)(payload) === "RegExp";
12
+ }
13
+ exports.isRegExp = isRegExp;
14
+ exports.default = isRegExp;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isServer = void 0;
4
+ var isBrowser_1 = require("./isBrowser");
5
+ /**
6
+ * @category ssr
7
+ * @category is
8
+ */
9
+ exports.isServer = !isBrowser_1.default;
10
+ // export const isServer = () => !isUndefined(window);
11
+ exports.default = exports.isServer;
package/node/isSet.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSet = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a Set
7
+ *
8
+ * @category is
9
+ */
10
+ function isSet(payload) {
11
+ return (0, getType_1.default)(payload) === "Set";
12
+ }
13
+ exports.isSet = isSet;
14
+ exports.default = isSet;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isString = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a string
7
+ *
8
+ * @category is
9
+ */
10
+ function isString(payload) {
11
+ return (0, getType_1.default)(payload) === "String";
12
+ }
13
+ exports.isString = isString;
14
+ exports.default = isString;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSymbol = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a Symbol
7
+ *
8
+ * @category is
9
+ */
10
+ function isSymbol(payload) {
11
+ return (0, getType_1.default)(payload) === "Symbol";
12
+ }
13
+ exports.isSymbol = isSymbol;
14
+ exports.default = isSymbol;
package/node/isType.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isType = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Does a generic check to check that the given payload is of a given type.
7
+ * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
8
+ * It will, however, differentiate between object and null
9
+ *
10
+ * @category is
11
+ * @throws {TypeError} Will throw type error if type is an invalid type
12
+ */
13
+ function isType(payload, type) {
14
+ if (!(type instanceof Function)) {
15
+ throw new TypeError("Type must be a function");
16
+ }
17
+ if (!Object.prototype.hasOwnProperty.call(type, "prototype")) {
18
+ throw new TypeError("Type is not a class");
19
+ }
20
+ // Classes usually have names (as functions usually have names)
21
+ var name = type.name;
22
+ return ((0, getType_1.default)(payload) === name ||
23
+ Boolean(payload && payload.constructor === type));
24
+ }
25
+ exports.isType = isType;
26
+ exports.default = isType;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isUndefined = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is undefined
7
+ *
8
+ * @category is
9
+ */
10
+ function isUndefined(payload) {
11
+ return (0, getType_1.default)(payload) === "Undefined";
12
+ }
13
+ exports.isUndefined = isUndefined;
14
+ exports.default = isUndefined;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWeakMap = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a WeakMap
7
+ *
8
+ * @category is
9
+ */
10
+ function isWeakMap(payload) {
11
+ return (0, getType_1.default)(payload) === "WeakMap";
12
+ }
13
+ exports.isWeakMap = isWeakMap;
14
+ exports.default = isWeakMap;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWeakSet = void 0;
4
+ var getType_1 = require("./getType");
5
+ /**
6
+ * Returns whether the payload is a WeakSet
7
+ *
8
+ * @category is
9
+ */
10
+ function isWeakSet(payload) {
11
+ return (0, getType_1.default)(payload) === "WeakSet";
12
+ }
13
+ exports.isWeakSet = isWeakSet;
14
+ exports.default = isWeakSet;