@mll-lab/js-utils 2.14.0 → 2.15.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.
- package/dist/index.common.js +82 -9
- package/dist/index.common.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +82 -9
- package/dist/index.js.map +1 -1
- package/dist/predicates.d.ts +1 -1
- package/dist/promise.d.ts +8 -0
- package/dist/promise.test.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.common.js
CHANGED
|
@@ -15212,6 +15212,37 @@ function __rest(s, e) {
|
|
|
15212
15212
|
}
|
|
15213
15213
|
return t;
|
|
15214
15214
|
}
|
|
15215
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
15216
|
+
function adopt(value) {
|
|
15217
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
15218
|
+
resolve(value);
|
|
15219
|
+
});
|
|
15220
|
+
}
|
|
15221
|
+
|
|
15222
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15223
|
+
function fulfilled(value) {
|
|
15224
|
+
try {
|
|
15225
|
+
step(generator.next(value));
|
|
15226
|
+
} catch (e) {
|
|
15227
|
+
reject(e);
|
|
15228
|
+
}
|
|
15229
|
+
}
|
|
15230
|
+
|
|
15231
|
+
function rejected(value) {
|
|
15232
|
+
try {
|
|
15233
|
+
step(generator["throw"](value));
|
|
15234
|
+
} catch (e) {
|
|
15235
|
+
reject(e);
|
|
15236
|
+
}
|
|
15237
|
+
}
|
|
15238
|
+
|
|
15239
|
+
function step(result) {
|
|
15240
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
15241
|
+
}
|
|
15242
|
+
|
|
15243
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15244
|
+
});
|
|
15245
|
+
}
|
|
15215
15246
|
|
|
15216
15247
|
const GERMAN_THOUSAND_SEPARATOR = '.';
|
|
15217
15248
|
const GERMAN_DECIMAL_SEPARATOR = ',';
|
|
@@ -15288,20 +15319,28 @@ function pluralize(amount, singular, plural) {
|
|
|
15288
15319
|
function isString(value) {
|
|
15289
15320
|
return typeof value === 'string';
|
|
15290
15321
|
}
|
|
15291
|
-
const isAlphanumeric =
|
|
15322
|
+
const isAlphanumeric = function isAlphanumeric(value) {
|
|
15323
|
+
return isString(value) && /^[A-Za-z0-9]+$/.test(value);
|
|
15324
|
+
};
|
|
15292
15325
|
/**
|
|
15293
15326
|
* BSNR (Betriebsstättennummer) ist eine eindeutige Zuordnung von Leistungen zu dem entsprechenden Ort der Leistungserbringung ermöglicht,
|
|
15294
15327
|
* für alle vertrags(zahn)ärztlichen Leistungserbringer gültig
|
|
15295
15328
|
* und klar abzugrenzen vom Institutskennzeichen (IK-Nummer) eines Krankenhauses.
|
|
15296
15329
|
*/
|
|
15297
|
-
const isBSNR =
|
|
15330
|
+
const isBSNR = function isBSNR(value) {
|
|
15331
|
+
return isString(value) && /^\d{9}$/.test(value);
|
|
15332
|
+
};
|
|
15298
15333
|
// Taken from https://emailregex.com
|
|
15299
15334
|
const EMAIL_REGEX =
|
|
15300
15335
|
// eslint-disable-next-line no-useless-escape
|
|
15301
15336
|
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
15302
|
-
const isEmail =
|
|
15303
|
-
|
|
15304
|
-
|
|
15337
|
+
const isEmail = function isEmail(value) {
|
|
15338
|
+
return isString(value) && EMAIL_REGEX.test(value);
|
|
15339
|
+
};
|
|
15340
|
+
const isOnlyDigits = function isOnlyDigits(value) {
|
|
15341
|
+
return isString(value) && /^\d+$/.test(value);
|
|
15342
|
+
};
|
|
15343
|
+
const isURL = function isURL(value) {
|
|
15305
15344
|
if (!isString(value)) {
|
|
15306
15345
|
return false;
|
|
15307
15346
|
}
|
|
@@ -15315,11 +15354,43 @@ const isURL = (value) => {
|
|
|
15315
15354
|
return false;
|
|
15316
15355
|
}
|
|
15317
15356
|
};
|
|
15318
|
-
const isWord =
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
function
|
|
15357
|
+
const isWord = function isWord(value) {
|
|
15358
|
+
return isString(value) && /^[\w-]+$/.test(value);
|
|
15359
|
+
};
|
|
15360
|
+
const isLabId = function isLabId(value) {
|
|
15361
|
+
return isString(value) && /^\d{2}-\d{6}$/.test(value);
|
|
15362
|
+
};
|
|
15363
|
+
const isRackBarcode = function isRackBarcode(value) {
|
|
15364
|
+
return isString(value) && /^[A-Z]{2}\d{8}$/.test(value);
|
|
15365
|
+
};
|
|
15366
|
+
const isNotNullish = function isNotNullish(value) {
|
|
15322
15367
|
return value != null;
|
|
15368
|
+
};
|
|
15369
|
+
|
|
15370
|
+
/**
|
|
15371
|
+
* Call an array of promises in order, waiting for each promise to resolve before calling the next.
|
|
15372
|
+
*/
|
|
15373
|
+
function callSequentially(promises) {
|
|
15374
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15375
|
+
return promises.reduce((promise, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
15376
|
+
yield promise;
|
|
15377
|
+
return callback();
|
|
15378
|
+
}), Promise.resolve());
|
|
15379
|
+
});
|
|
15380
|
+
}
|
|
15381
|
+
/**
|
|
15382
|
+
* Map an array using an asynchronous callback function, waiting for each promise to resolve before calling the next.
|
|
15383
|
+
*/
|
|
15384
|
+
function mapSequentially(array, callbackFn) {
|
|
15385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15386
|
+
const results = [];
|
|
15387
|
+
yield array.reduce((promise, value) => __awaiter(this, void 0, void 0, function* () {
|
|
15388
|
+
yield promise;
|
|
15389
|
+
const result = yield callbackFn(value);
|
|
15390
|
+
results.push(result);
|
|
15391
|
+
}), Promise.resolve());
|
|
15392
|
+
return results;
|
|
15393
|
+
});
|
|
15323
15394
|
}
|
|
15324
15395
|
|
|
15325
15396
|
function includesIgnoreCase(needle, haystack) {
|
|
@@ -15365,6 +15436,7 @@ exports.GERMAN_THOUSAND_SEPARATOR = GERMAN_THOUSAND_SEPARATOR;
|
|
|
15365
15436
|
exports.ISO_DATE_FORMAT = ISO_DATE_FORMAT;
|
|
15366
15437
|
exports.ISO_DATE_TIME_FORMAT = ISO_DATE_TIME_FORMAT;
|
|
15367
15438
|
exports.SECONDLESS_DATE_TIME_FORMAT = SECONDLESS_DATE_TIME_FORMAT;
|
|
15439
|
+
exports.callSequentially = callSequentially;
|
|
15368
15440
|
exports.containSameValues = containSameValues;
|
|
15369
15441
|
exports.downloadBlob = downloadBlob;
|
|
15370
15442
|
exports.errorMessage = errorMessage;
|
|
@@ -15397,6 +15469,7 @@ exports.isURL = isURL;
|
|
|
15397
15469
|
exports.isWord = isWord;
|
|
15398
15470
|
exports.joinNonEmpty = joinNonEmpty;
|
|
15399
15471
|
exports.last = last;
|
|
15472
|
+
exports.mapSequentially = mapSequentially;
|
|
15400
15473
|
exports.parseDate = parseDate;
|
|
15401
15474
|
exports.parseDotlessDate = parseDotlessDate;
|
|
15402
15475
|
exports.parseGermanDate = parseGermanDate;
|