cafe-utility 19.0.0 → 19.1.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 (3) hide show
  1. package/index.d.ts +4 -0
  2. package/index.js +8 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -64,6 +64,8 @@ declare function isBoolean(value: any): value is boolean;
64
64
  declare function isDate(value: any): value is Date;
65
65
  declare function isBlank(value: any): boolean;
66
66
  declare function isId(value: any): value is number;
67
+ declare function isIntegerString(value: any): boolean;
68
+ declare function isHexString(value: any): boolean;
67
69
  declare function randomLetterString(length: number, generator?: () => number): string;
68
70
  declare function randomAlphanumericString(length: number, generator?: () => number): string;
69
71
  declare function randomRichAsciiString(length: number, generator?: () => number): string;
@@ -611,6 +613,8 @@ export declare const Types: {
611
613
  isDate: typeof isDate;
612
614
  isBlank: typeof isBlank;
613
615
  isId: typeof isId;
616
+ isIntegerString: typeof isIntegerString;
617
+ isHexString: typeof isHexString;
614
618
  isUrl: typeof isUrl;
615
619
  isNullable: typeof isNullable;
616
620
  asString: typeof asString;
package/index.js CHANGED
@@ -304,6 +304,12 @@ function isBlank(n) {
304
304
  function isId(n) {
305
305
  return isNumber(n) && Number.isInteger(n) && n >= 1
306
306
  }
307
+ function isIntegerString(n) {
308
+ return isString(n) && n.match(/^-?\d+$/) !== null
309
+ }
310
+ function isHexString(n) {
311
+ return isString(n) && n.match(/^(0x)?[0-9a-f]+$/i) !== null
312
+ }
307
313
  const symbols = '!@#$%^&*()_+-=[]{}|;:<>?,./',
308
314
  symbolsArray = '!@#$%^&*()_+-=[]{}|;:<>?,./'.split(''),
309
315
  lowercaseAlphabet = 'abcdefghijklmnopqrstuvwxyz',
@@ -2245,6 +2251,8 @@ function raycastCircle(n, t, e) {
2245
2251
  isDate,
2246
2252
  isBlank,
2247
2253
  isId,
2254
+ isIntegerString,
2255
+ isHexString,
2248
2256
  isUrl,
2249
2257
  isNullable,
2250
2258
  asString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "19.0.0",
3
+ "version": "19.1.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {