diginext-utils 4.0.0 → 4.0.2
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/Checker.js +3 -7
- package/dist/Checker.js.map +1 -1
- package/dist/EventDispatcher.js +2 -5
- package/dist/EventDispatcher.js.map +1 -1
- package/dist/FileUpload.js +2 -5
- package/dist/FileUpload.js.map +1 -1
- package/dist/Slug.js +3 -7
- package/dist/Slug.js.map +1 -1
- package/dist/Timer.js +12 -5
- package/dist/Timer.js.map +1 -1
- package/dist/Validation.js +1 -3
- package/dist/Validation.js.map +1 -1
- package/dist/array/average.js +3 -6
- package/dist/array/average.js.map +1 -1
- package/dist/array/chunk.js +1 -4
- package/dist/array/chunk.js.map +1 -1
- package/dist/array/compact.js +1 -4
- package/dist/array/compact.js.map +1 -1
- package/dist/array/difference.js +1 -4
- package/dist/array/difference.js.map +1 -1
- package/dist/array/first.js +1 -4
- package/dist/array/first.js.map +1 -1
- package/dist/array/flatten.js +1 -4
- package/dist/array/flatten.js.map +1 -1
- package/dist/array/index.js +22 -47
- package/dist/array/index.js.map +1 -1
- package/dist/array/intersection.js +1 -4
- package/dist/array/intersection.js.map +1 -1
- package/dist/array/last.js +1 -4
- package/dist/array/last.js.map +1 -1
- package/dist/array/max.js +1 -4
- package/dist/array/max.js.map +1 -1
- package/dist/array/min.js +1 -4
- package/dist/array/min.js.map +1 -1
- package/dist/array/moveElement.js +1 -4
- package/dist/array/moveElement.js.map +1 -1
- package/dist/array/randomElement.js +3 -6
- package/dist/array/randomElement.js.map +1 -1
- package/dist/array/randomIndex.js +1 -4
- package/dist/array/randomIndex.js.map +1 -1
- package/dist/array/removeItem.js +1 -4
- package/dist/array/removeItem.js.map +1 -1
- package/dist/array/removeItemByKey.js +1 -4
- package/dist/array/removeItemByKey.js.map +1 -1
- package/dist/array/sample.js +1 -4
- package/dist/array/sample.js.map +1 -1
- package/dist/array/shuffle.js +1 -4
- package/dist/array/shuffle.js.map +1 -1
- package/dist/array/sortByNumber.js +1 -4
- package/dist/array/sortByNumber.js.map +1 -1
- package/dist/array/sortByString.js +1 -4
- package/dist/array/sortByString.js.map +1 -1
- package/dist/array/sum.js +1 -4
- package/dist/array/sum.js.map +1 -1
- package/dist/array/union.js +1 -4
- package/dist/array/union.js.map +1 -1
- package/dist/array/unique.js +1 -4
- package/dist/array/unique.js.map +1 -1
- package/dist/array.js +44 -66
- package/dist/array.js.map +1 -1
- package/dist/cached/CacheManager.js +3 -9
- package/dist/cached/CacheManager.js.map +1 -1
- package/dist/color.js +19 -29
- package/dist/color.js.map +1 -1
- package/dist/date/index.js +2 -10
- package/dist/date/index.js.map +1 -1
- package/dist/date/timeAgo.js +1 -4
- package/dist/date/timeAgo.js.map +1 -1
- package/dist/device/browser.js +7 -15
- package/dist/device/browser.js.map +1 -1
- package/dist/device/camera.js +14 -8
- package/dist/device/camera.js.map +1 -1
- package/dist/device/index.js +8 -16
- package/dist/device/index.js.map +1 -1
- package/dist/device/os.js +10 -19
- package/dist/device/os.js.map +1 -1
- package/dist/email/index.js +14 -21
- package/dist/email/index.js.map +1 -1
- package/dist/file/createDir.js +1 -3
- package/dist/file/createDir.js.map +1 -1
- package/dist/file/detectPrivateKey.js +6 -12
- package/dist/file/detectPrivateKey.js.map +1 -1
- package/dist/file/detectPrivateKeyByFilePath.js +7 -13
- package/dist/file/detectPrivateKeyByFilePath.js.map +1 -1
- package/dist/file/fileMove.js +1 -4
- package/dist/file/fileMove.js.map +1 -1
- package/dist/file/findFilesByExt.js +4 -8
- package/dist/file/findFilesByExt.js.map +1 -1
- package/dist/file/getAllFiles.js +8 -14
- package/dist/file/getAllFiles.js.map +1 -1
- package/dist/file/index.js +5 -10
- package/dist/file/index.js.map +1 -1
- package/dist/file/parseEnvFile.js +5 -11
- package/dist/file/parseEnvFile.js.map +1 -1
- package/dist/gameboi/index.js +3 -8
- package/dist/gameboi/index.js.map +1 -1
- package/dist/html/transform3dToObject.js +1 -4
- package/dist/html/transform3dToObject.js.map +1 -1
- package/dist/images/downloadByUrl.js +40 -36
- package/dist/images/downloadByUrl.js.map +1 -1
- package/dist/images/getImageDimensions.js +26 -18
- package/dist/images/getImageDimensions.js.map +1 -1
- package/dist/images/getUrlBypassCors.js +1 -3
- package/dist/images/getUrlBypassCors.js.map +1 -1
- package/dist/images/index.js +2 -7
- package/dist/images/index.js.map +1 -1
- package/dist/images/loadImage.js +24 -16
- package/dist/images/loadImage.js.map +1 -1
- package/dist/images/loadImageAsBlobUrl.js +28 -23
- package/dist/images/loadImageAsBlobUrl.js.map +1 -1
- package/dist/images/resize.js +16 -18
- package/dist/images/resize.js.map +1 -1
- package/dist/images/upload.js +17 -15
- package/dist/images/upload.js.map +1 -1
- package/dist/index.js +22 -52
- package/dist/index.js.map +1 -1
- package/dist/json.js +3 -7
- package/dist/json.js.map +1 -1
- package/dist/lib/batchProcessor.js +25 -15
- package/dist/lib/batchProcessor.js.map +1 -1
- package/dist/math/angleBetweenPoints.js +1 -4
- package/dist/math/angleBetweenPoints.js.map +1 -1
- package/dist/math/clamp.js +1 -4
- package/dist/math/clamp.js.map +1 -1
- package/dist/math/degToRad.js +1 -4
- package/dist/math/degToRad.js.map +1 -1
- package/dist/math/diffDate.js +2 -5
- package/dist/math/diffDate.js.map +1 -1
- package/dist/math/distance.js +1 -4
- package/dist/math/distance.js.map +1 -1
- package/dist/math/index.js +14 -29
- package/dist/math/index.js.map +1 -1
- package/dist/math/lerp.js +1 -4
- package/dist/math/lerp.js.map +1 -1
- package/dist/math/positiveNumber.js +4 -7
- package/dist/math/positiveNumber.js.map +1 -1
- package/dist/math/radToDeg.js +1 -4
- package/dist/math/radToDeg.js.map +1 -1
- package/dist/math/random.js +1 -4
- package/dist/math/random.js.map +1 -1
- package/dist/math/randomFloat.js +1 -4
- package/dist/math/randomFloat.js.map +1 -1
- package/dist/math/randomInt.js +1 -4
- package/dist/math/randomInt.js.map +1 -1
- package/dist/math/round.js +1 -4
- package/dist/math/round.js.map +1 -1
- package/dist/name/en.js +2 -5
- package/dist/name/en.js.map +1 -1
- package/dist/name/index.js +5 -12
- package/dist/name/index.js.map +1 -1
- package/dist/name/vi.js +7 -11
- package/dist/name/vi.js.map +1 -1
- package/dist/object/deepClone.js +1 -4
- package/dist/object/deepClone.js.map +1 -1
- package/dist/object/index.js +14 -31
- package/dist/object/index.js.map +1 -1
- package/dist/object/isEmpty.js +1 -4
- package/dist/object/isEmpty.js.map +1 -1
- package/dist/object/isEqual.js +3 -6
- package/dist/object/isEqual.js.map +1 -1
- package/dist/object/isNull.js +1 -4
- package/dist/object/isNull.js.map +1 -1
- package/dist/object/isObject.js +1 -4
- package/dist/object/isObject.js.map +1 -1
- package/dist/object/iterate.js +1 -4
- package/dist/object/iterate.js.map +1 -1
- package/dist/object/merge.js +4 -7
- package/dist/object/merge.js.map +1 -1
- package/dist/object/omit.js +1 -4
- package/dist/object/omit.js.map +1 -1
- package/dist/object/pick.js +1 -4
- package/dist/object/pick.js.map +1 -1
- package/dist/object/toArray.js +3 -6
- package/dist/object/toArray.js.map +1 -1
- package/dist/object/toBool.js +6 -9
- package/dist/object/toBool.js.map +1 -1
- package/dist/object/toFloat.js +3 -6
- package/dist/object/toFloat.js.map +1 -1
- package/dist/object/toInt.js +3 -6
- package/dist/object/toInt.js.map +1 -1
- package/dist/object/toObject.js +1 -4
- package/dist/object/toObject.js.map +1 -1
- package/dist/object.js +25 -36
- package/dist/object.js.map +1 -1
- package/dist/permission/index.js +4 -6
- package/dist/permission/index.js.map +1 -1
- package/dist/permission/requestCamera.js +2 -6
- package/dist/permission/requestCamera.js.map +1 -1
- package/dist/permission/requestDeviceOrientationControl.js +4 -8
- package/dist/permission/requestDeviceOrientationControl.js.map +1 -1
- package/dist/response/index.js +18 -24
- package/dist/response/index.js.map +1 -1
- package/dist/string/convertPathnameAndQuery.js +3 -6
- package/dist/string/convertPathnameAndQuery.js.map +1 -1
- package/dist/string/formatBytes.js +1 -4
- package/dist/string/formatBytes.js.map +1 -1
- package/dist/string/formatNumber.js +4 -7
- package/dist/string/formatNumber.js.map +1 -1
- package/dist/string/generatePassword.js +5 -8
- package/dist/string/generatePassword.js.map +1 -1
- package/dist/string/generateUUID.js +2 -5
- package/dist/string/generateUUID.js.map +1 -1
- package/dist/string/getIntFromNextJsRouter.js +4 -7
- package/dist/string/getIntFromNextJsRouter.js.map +1 -1
- package/dist/string/getStringFromNextJsRouter.js +3 -6
- package/dist/string/getStringFromNextJsRouter.js.map +1 -1
- package/dist/string/getTextBetweenCharByIndex.js +3 -9
- package/dist/string/getTextBetweenCharByIndex.js.map +1 -1
- package/dist/string/guessMimeType.js +77 -69
- package/dist/string/guessMimeType.js.map +1 -1
- package/dist/string/guessMimeTypeByBuffer.js +1 -4
- package/dist/string/guessMimeTypeByBuffer.js.map +1 -1
- package/dist/string/index.js +47 -58
- package/dist/string/index.js.map +1 -1
- package/dist/string/indexesOf.js +1 -4
- package/dist/string/indexesOf.js.map +1 -1
- package/dist/string/makeDaySlug.js +5 -11
- package/dist/string/makeDaySlug.js.map +1 -1
- package/dist/string/makeSlug.js +3 -6
- package/dist/string/makeSlug.js.map +1 -1
- package/dist/string/padNumberWithLeadingZeros.js +1 -4
- package/dist/string/padNumberWithLeadingZeros.js.map +1 -1
- package/dist/string/random.js +17 -25
- package/dist/string/random.js.map +1 -1
- package/dist/string/trimNull.js +4 -10
- package/dist/string/trimNull.js.map +1 -1
- package/dist/string/url.js +24 -37
- package/dist/string/url.js.map +1 -1
- package/dist/xconsole/enableConsole.js +4 -10
- package/dist/xconsole/enableConsole.js.map +1 -1
- package/dist/xconsole/index.js +6 -11
- package/dist/xconsole/index.js.map +1 -1
- package/dist/xconsole/log.js +15 -27
- package/dist/xconsole/log.js.map +1 -1
- package/esm/Timer.js +11 -2
- package/esm/Timer.js.map +1 -1
- package/esm/color.js +1 -1
- package/esm/color.js.map +1 -1
- package/esm/device/camera.js +12 -3
- package/esm/device/camera.js.map +1 -1
- package/esm/email/index.js +12 -12
- package/esm/email/index.js.map +1 -1
- package/esm/file/index.js +1 -1
- package/esm/file/index.js.map +1 -1
- package/esm/images/downloadByUrl.js +33 -22
- package/esm/images/downloadByUrl.js.map +1 -1
- package/esm/images/getImageDimensions.js +26 -15
- package/esm/images/getImageDimensions.js.map +1 -1
- package/esm/images/loadImage.js +24 -13
- package/esm/images/loadImage.js.map +1 -1
- package/esm/images/loadImageAsBlobUrl.js +28 -17
- package/esm/images/loadImageAsBlobUrl.js.map +1 -1
- package/esm/images/resize.js +15 -10
- package/esm/images/resize.js.map +1 -1
- package/esm/images/upload.js +12 -3
- package/esm/images/upload.js.map +1 -1
- package/esm/lib/batchProcessor.js +25 -12
- package/esm/lib/batchProcessor.js.map +1 -1
- package/esm/string/guessMimeType.js +75 -64
- package/esm/string/guessMimeType.js.map +1 -1
- package/package.json +13 -1
package/dist/images/resize.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
4
9
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const blueimp_load_image_1 = __importDefault(require("blueimp-load-image"));
|
|
8
|
-
const resize = async (file, options) => {
|
|
10
|
+
import loadImage from "blueimp-load-image";
|
|
11
|
+
export const resize = (file, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9
12
|
if (!file) {
|
|
10
13
|
console.error("NO FILE AVAIABLE!");
|
|
11
14
|
return;
|
|
@@ -13,15 +16,11 @@ const resize = async (file, options) => {
|
|
|
13
16
|
const maxWidth = (options === null || options === void 0 ? void 0 : options.maxWidth) || 2048;
|
|
14
17
|
const maxHeight = (options === null || options === void 0 ? void 0 : options.maxHeight) || 2048;
|
|
15
18
|
const { type } = file;
|
|
16
|
-
const data =
|
|
19
|
+
const data = yield loadImage(file, Object.assign(Object.assign({
|
|
17
20
|
//
|
|
18
|
-
meta: false,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
maxWidth,
|
|
22
|
-
maxHeight,
|
|
23
|
-
});
|
|
24
|
-
const blob = await new Promise(function (resolve) {
|
|
21
|
+
meta: false, canvas: true }, options), { maxWidth,
|
|
22
|
+
maxHeight }));
|
|
23
|
+
const blob = yield new Promise(function (resolve) {
|
|
25
24
|
try {
|
|
26
25
|
const canvas = data.image;
|
|
27
26
|
canvas.toBlob(function (blob) {
|
|
@@ -35,7 +34,6 @@ const resize = async (file, options) => {
|
|
|
35
34
|
if (blob)
|
|
36
35
|
return blob;
|
|
37
36
|
return data;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.default = exports.resize;
|
|
37
|
+
});
|
|
38
|
+
export default resize;
|
|
41
39
|
//# sourceMappingURL=resize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../../src/images/resize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../../src/images/resize.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAA+B,MAAM,oBAAoB,CAAC;AAEjE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAO,IAAU,EAAE,OAA0B,EAAE,EAAE;IACtE,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACnC,OAAO;IACR,CAAC;IAED,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,IAAI,CAAC;IAC3C,MAAM,SAAS,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,IAAI,CAAC;IAE7C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtB,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,IAAI;QAChC,EAAE;QACF,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,IAAI,IACT,OAAO,KACV,QAAQ;QACR,SAAS,IACR,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,IAAI,OAAO,CAAC,UAAU,OAAO;QAC/C,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAY,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,UAAU,IAAU;gBACjC,OAAO,CAAC,IAAI,CAAC,CAAC;YACf,CAAC,EAAE,IAAI,CAAC,CAAC;QACV,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE,KAAK,CAAC,CAAC;QACjF,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAEtB,OAAO,IAAI,CAAC;AACb,CAAC,CAAA,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/images/upload.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
4
9
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const url_1 = require("./../string/url");
|
|
10
|
-
const upload = async (file) => {
|
|
10
|
+
import { getFailedResponse } from "./../response/index";
|
|
11
|
+
import resize from "./resize";
|
|
12
|
+
import { isImage } from "./../string/url";
|
|
13
|
+
export const upload = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
14
|
const { name } = file;
|
|
12
|
-
if (!
|
|
15
|
+
if (!isImage(name)) {
|
|
13
16
|
const err = "Please Choose Image!";
|
|
14
17
|
console.error(err);
|
|
15
|
-
return
|
|
18
|
+
return getFailedResponse(err);
|
|
16
19
|
}
|
|
17
|
-
const blob = (
|
|
20
|
+
const blob = (yield resize(file));
|
|
18
21
|
const url = URL.createObjectURL(blob);
|
|
19
22
|
blob.name = name;
|
|
20
23
|
return {
|
|
21
24
|
blob,
|
|
22
25
|
url,
|
|
23
26
|
};
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.default = exports.upload;
|
|
27
|
+
});
|
|
28
|
+
export default upload;
|
|
27
29
|
//# sourceMappingURL=upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/images/upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/images/upload.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAO,IAAU,EAAE,EAAE;IAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,sBAAsB,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAQ,CAAC;IACzC,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAY,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAEjB,OAAO;QACN,IAAI;QACJ,GAAG;KACH,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,69 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Diginext Utils - Professional utility library
|
|
4
3
|
* @packageDocumentation
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.date = exports.device = exports.file = exports.string = exports.math = exports.object = exports.array = void 0;
|
|
41
|
-
// Re-export all modules as namespaces
|
|
42
|
-
exports.array = __importStar(require("./array"));
|
|
43
|
-
exports.object = __importStar(require("./object"));
|
|
44
|
-
exports.math = __importStar(require("./math"));
|
|
45
|
-
exports.string = __importStar(require("./string"));
|
|
46
|
-
exports.file = __importStar(require("./file"));
|
|
47
|
-
exports.device = __importStar(require("./device"));
|
|
48
|
-
exports.date = __importStar(require("./date"));
|
|
5
|
+
import * as array_1 from "./array";
|
|
6
|
+
export { array_1 as array };
|
|
7
|
+
import * as object_1 from "./object";
|
|
8
|
+
export { object_1 as object };
|
|
9
|
+
import * as math_1 from "./math";
|
|
10
|
+
export { math_1 as math };
|
|
11
|
+
import * as string_1 from "./string";
|
|
12
|
+
export { string_1 as string };
|
|
13
|
+
import * as file_1 from "./file";
|
|
14
|
+
export { file_1 as file };
|
|
15
|
+
import * as device_1 from "./device";
|
|
16
|
+
export { device_1 as device };
|
|
17
|
+
import * as date_1 from "./date";
|
|
18
|
+
export { date_1 as date };
|
|
49
19
|
// For tree-shaking, users can import directly from subpaths:
|
|
50
20
|
// import { sum, average } from 'diginext-utils/array'
|
|
51
21
|
// import { isNull, toBool } from 'diginext-utils/object'
|
|
52
22
|
// import { randomInt, clamp } from 'diginext-utils/math'
|
|
53
23
|
// Backward compatibility - default export
|
|
54
24
|
// Note: This uses dynamic imports which may not work in all environments
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
25
|
+
import * as arrayModule from "./array";
|
|
26
|
+
import * as objectModule from "./object";
|
|
27
|
+
import * as mathModule from "./math";
|
|
28
|
+
import * as stringModule from "./string";
|
|
29
|
+
import * as fileModule from "./file";
|
|
30
|
+
import * as deviceModule from "./device";
|
|
31
|
+
import * as dateModule from "./date";
|
|
62
32
|
/**
|
|
63
33
|
* Default export maintaining backward compatibility
|
|
64
34
|
* @deprecated Use named exports instead for better tree-shaking
|
|
65
35
|
*/
|
|
66
|
-
|
|
36
|
+
export default {
|
|
67
37
|
array: arrayModule,
|
|
68
38
|
object: objectModule,
|
|
69
39
|
math: mathModule,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;yBAGoB,SAAS;oBAApB,KAAK;0BACO,UAAU;qBAAtB,MAAM;wBACI,QAAQ;mBAAlB,IAAI;0BACQ,UAAU;qBAAtB,MAAM;wBACI,QAAQ;mBAAlB,IAAI;0BACQ,UAAU;qBAAtB,MAAM;wBACI,QAAQ;mBAAlB,IAAI;AAEhB,6DAA6D;AAC7D,sDAAsD;AACtD,yDAAyD;AACzD,yDAAyD;AAEzD,0CAA0C;AAC1C,yEAAyE;AACzE,OAAO,KAAK,WAAW,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,YAAY,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,YAAY,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,QAAQ,CAAC;AAErC;;;GAGG;AACH,eAAe;IACd,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,UAAU;CAChB,CAAC"}
|
package/dist/json.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValid = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Check if the object or string is in JSON format
|
|
6
3
|
*/
|
|
7
|
-
const isValid = (content) => {
|
|
4
|
+
export const isValid = (content) => {
|
|
8
5
|
if (typeof content == "object") {
|
|
9
6
|
try {
|
|
10
7
|
content = JSON.stringify(content);
|
|
@@ -26,7 +23,6 @@ const isValid = (content) => {
|
|
|
26
23
|
}
|
|
27
24
|
return true;
|
|
28
25
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
exports.default = xjson;
|
|
26
|
+
const xjson = { isValid };
|
|
27
|
+
export default xjson;
|
|
32
28
|
//# sourceMappingURL=json.js.map
|
package/dist/json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAwB,EAAE,EAAE;IACnD,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC;YACJ,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IAED,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC;YACJ,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IAED,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,CAAC;AAE1B,eAAe,KAAK,CAAC"}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export default function batchProcessor(list_1, callback_1) {
|
|
11
|
+
return __awaiter(this, arguments, void 0, function* (list, callback, batchSize = 10) {
|
|
12
|
+
let res = [];
|
|
13
|
+
// Function to process a single batch
|
|
14
|
+
function processBatch(batch) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
return yield Promise.all(batch.map((item) => callback(item)));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// Divide the list into batches
|
|
20
|
+
for (let i = 0; i < list.length; i += batchSize) {
|
|
21
|
+
const batch = list.slice(i, i + batchSize);
|
|
22
|
+
res = [...res, ...(yield processBatch(batch))]; // Process each batch and wait for it to complete
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
});
|
|
16
26
|
}
|
|
17
27
|
//# sourceMappingURL=batchProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchProcessor.js","sourceRoot":"","sources":["../../src/lib/batchProcessor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batchProcessor.js","sourceRoot":"","sources":["../../src/lib/batchProcessor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAO,UAAgB,cAAc;yDAAI,IAAS,EAAE,QAAmC,EAAE,YAAoB,EAAE;QACrH,IAAI,GAAG,GAAG,EAAS,CAAC;QACpB,qCAAqC;QACrC,SAAe,YAAY,CAAC,KAAU;;gBACrC,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/D,CAAC;SAAA;QAED,+BAA+B;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;YACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC;YAC3C,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,iDAAiD;QAClG,CAAC;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;CAAA"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.angleBetweenPoints = angleBetweenPoints;
|
|
4
1
|
/**
|
|
5
2
|
* Calculates the angle in degrees between two points.
|
|
6
3
|
* The angle is measured from the positive x-axis.
|
|
@@ -19,7 +16,7 @@ exports.angleBetweenPoints = angleBetweenPoints;
|
|
|
19
16
|
* angleBetweenPoints(0, 0, -1, 0); // 180 or -180 (pointing left)
|
|
20
17
|
* ```
|
|
21
18
|
*/
|
|
22
|
-
function angleBetweenPoints(x1, y1, x2, y2) {
|
|
19
|
+
export function angleBetweenPoints(x1, y1, x2, y2) {
|
|
23
20
|
const dy = y2 - y1;
|
|
24
21
|
const dx = x2 - x1;
|
|
25
22
|
let theta = Math.atan2(dy, dx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angleBetweenPoints.js","sourceRoot":"","sources":["../../src/math/angleBetweenPoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"angleBetweenPoints.js","sourceRoot":"","sources":["../../src/math/angleBetweenPoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;IAChF,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACnB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/B,KAAK,IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;IACvB,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/math/clamp.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clamp = clamp;
|
|
4
1
|
/**
|
|
5
2
|
* Clamps a number between a minimum and maximum value.
|
|
6
3
|
* Returns 0 if the result is not finite.
|
|
@@ -17,7 +14,7 @@ exports.clamp = clamp;
|
|
|
17
14
|
* clamp(5, 0, 10); // 5
|
|
18
15
|
* ```
|
|
19
16
|
*/
|
|
20
|
-
function clamp(value, min, max) {
|
|
17
|
+
export function clamp(value, min, max) {
|
|
21
18
|
const result = Math.max(min, Math.min(max, value));
|
|
22
19
|
return Number.isFinite(result) ? result : 0;
|
|
23
20
|
}
|
package/dist/math/clamp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../src/math/clamp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../src/math/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/math/degToRad.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.degToRad = degToRad;
|
|
4
1
|
/**
|
|
5
2
|
* Constant: Degrees to radians conversion factor
|
|
6
3
|
*/
|
|
@@ -18,7 +15,7 @@ const DEG_TO_RAD = Math.PI / 180;
|
|
|
18
15
|
* degToRad(0); // 0
|
|
19
16
|
* ```
|
|
20
17
|
*/
|
|
21
|
-
function degToRad(degrees) {
|
|
18
|
+
export function degToRad(degrees) {
|
|
22
19
|
return degrees * DEG_TO_RAD;
|
|
23
20
|
}
|
|
24
21
|
//# sourceMappingURL=degToRad.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"degToRad.js","sourceRoot":"","sources":["../../src/math/degToRad.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"degToRad.js","sourceRoot":"","sources":["../../src/math/degToRad.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACvC,OAAO,OAAO,GAAG,UAAU,CAAC;AAC7B,CAAC"}
|
package/dist/math/diffDate.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.diffDate = diffDate;
|
|
4
1
|
/**
|
|
5
2
|
* Returns amount of different days between 2 dates
|
|
6
3
|
*/
|
|
7
|
-
function diffDate(date1, date2) {
|
|
4
|
+
export function diffDate(date1, date2) {
|
|
8
5
|
date1 = date1 || new Date().toString();
|
|
9
6
|
date2 = date2 || new Date().toString();
|
|
10
7
|
return (new Date(date2).getTime() - new Date(date1).getTime()) / (24 * 60 * 60 * 1000);
|
|
11
8
|
}
|
|
12
|
-
|
|
9
|
+
export default diffDate;
|
|
13
10
|
//# sourceMappingURL=diffDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diffDate.js","sourceRoot":"","sources":["../../src/math/diffDate.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"diffDate.js","sourceRoot":"","sources":["../../src/math/diffDate.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,KAAa;IACpD,KAAK,GAAG,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvC,KAAK,GAAG,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACxF,CAAC;AAED,eAAe,QAAQ,CAAC"}
|
package/dist/math/distance.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.distance = distance;
|
|
4
1
|
/**
|
|
5
2
|
* Calculates the Euclidean distance between two points in 2D space.
|
|
6
3
|
* Returns 0 if the result is not finite.
|
|
@@ -17,7 +14,7 @@ exports.distance = distance;
|
|
|
17
14
|
* distance(1, 1, 4, 5); // 5
|
|
18
15
|
* ```
|
|
19
16
|
*/
|
|
20
|
-
function distance(x1, y1, x2, y2) {
|
|
17
|
+
export function distance(x1, y1, x2, y2) {
|
|
21
18
|
const dist = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
22
19
|
return Number.isFinite(dist) ? dist : 0;
|
|
23
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distance.js","sourceRoot":"","sources":["../../src/math/distance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"distance.js","sourceRoot":"","sources":["../../src/math/distance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/math/index.js
CHANGED
|
@@ -1,40 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Math utility functions
|
|
4
3
|
* @module math
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var radToDeg_1 = require("./radToDeg");
|
|
19
|
-
Object.defineProperty(exports, "radToDeg", { enumerable: true, get: function () { return radToDeg_1.radToDeg; } });
|
|
20
|
-
var distance_1 = require("./distance");
|
|
21
|
-
Object.defineProperty(exports, "distance", { enumerable: true, get: function () { return distance_1.distance; } });
|
|
22
|
-
var angleBetweenPoints_1 = require("./angleBetweenPoints");
|
|
23
|
-
Object.defineProperty(exports, "angleBetweenPoints", { enumerable: true, get: function () { return angleBetweenPoints_1.angleBetweenPoints; } });
|
|
24
|
-
var lerp_1 = require("./lerp");
|
|
25
|
-
Object.defineProperty(exports, "lerp", { enumerable: true, get: function () { return lerp_1.lerp; } });
|
|
26
|
-
var round_1 = require("./round");
|
|
27
|
-
Object.defineProperty(exports, "round", { enumerable: true, get: function () { return round_1.round; } });
|
|
28
|
-
var positiveNumber_1 = require("./positiveNumber");
|
|
29
|
-
Object.defineProperty(exports, "positiveNumber", { enumerable: true, get: function () { return positiveNumber_1.positiveNumber; } });
|
|
30
|
-
var diffDate_1 = require("./diffDate");
|
|
31
|
-
Object.defineProperty(exports, "diffDate", { enumerable: true, get: function () { return diffDate_1.diffDate; } });
|
|
5
|
+
export { random } from "./random";
|
|
6
|
+
export { randomInt } from "./randomInt";
|
|
7
|
+
export { randomFloat } from "./randomFloat";
|
|
8
|
+
export { clamp } from "./clamp";
|
|
9
|
+
export { degToRad } from "./degToRad";
|
|
10
|
+
export { radToDeg } from "./radToDeg";
|
|
11
|
+
export { distance } from "./distance";
|
|
12
|
+
export { angleBetweenPoints } from "./angleBetweenPoints";
|
|
13
|
+
export { lerp } from "./lerp";
|
|
14
|
+
export { round } from "./round";
|
|
15
|
+
export { positiveNumber } from "./positiveNumber";
|
|
16
|
+
export { diffDate } from "./diffDate";
|
|
32
17
|
/**
|
|
33
18
|
* Constant: Degrees to radians conversion factor
|
|
34
19
|
*/
|
|
35
|
-
|
|
20
|
+
export const DEG_TO_RAD = Math.PI / 180;
|
|
36
21
|
/**
|
|
37
22
|
* Constant: Radians to degrees conversion factor
|
|
38
23
|
*/
|
|
39
|
-
|
|
24
|
+
export const RAD_TO_DEG = 180 / Math.PI;
|
|
40
25
|
//# sourceMappingURL=index.js.map
|
package/dist/math/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC"}
|
package/dist/math/lerp.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lerp = lerp;
|
|
4
1
|
/**
|
|
5
2
|
* Linear interpolation between two values.
|
|
6
3
|
* Returns the value at a specific point between start and end.
|
|
@@ -18,7 +15,7 @@ exports.lerp = lerp;
|
|
|
18
15
|
* lerp(20, 80, 0.25); // 35
|
|
19
16
|
* ```
|
|
20
17
|
*/
|
|
21
|
-
function lerp(start, end, t) {
|
|
18
|
+
export function lerp(start, end, t) {
|
|
22
19
|
return start + (end - start) * t;
|
|
23
20
|
}
|
|
24
21
|
//# sourceMappingURL=lerp.js.map
|
package/dist/math/lerp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lerp.js","sourceRoot":"","sources":["../../src/math/lerp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lerp.js","sourceRoot":"","sources":["../../src/math/lerp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,IAAI,CAAC,KAAa,EAAE,GAAW,EAAE,CAAS;IACzD,OAAO,KAAK,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const object_1 = require("../object");
|
|
5
|
-
function positiveNumber(number) {
|
|
6
|
-
if ((0, object_1.isNull)(number))
|
|
1
|
+
import { isNull } from "../object";
|
|
2
|
+
export function positiveNumber(number) {
|
|
3
|
+
if (isNull(number))
|
|
7
4
|
return 0;
|
|
8
5
|
if (!Number.isFinite(Number(number)))
|
|
9
6
|
return 0;
|
|
@@ -12,5 +9,5 @@ function positiveNumber(number) {
|
|
|
12
9
|
return 0;
|
|
13
10
|
return number;
|
|
14
11
|
}
|
|
15
|
-
|
|
12
|
+
export default positiveNumber;
|
|
16
13
|
//# sourceMappingURL=positiveNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positiveNumber.js","sourceRoot":"","sources":["../../src/math/positiveNumber.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"positiveNumber.js","sourceRoot":"","sources":["../../src/math/positiveNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,UAAU,cAAc,CAAC,MAAc;IAC5C,IAAI,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAC/C,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IAEzB,OAAO,MAAM,CAAC;AACf,CAAC;AAED,eAAe,cAAc,CAAC"}
|
package/dist/math/radToDeg.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.radToDeg = radToDeg;
|
|
4
1
|
/**
|
|
5
2
|
* Constant: Radians to degrees conversion factor
|
|
6
3
|
*/
|
|
@@ -18,7 +15,7 @@ const RAD_TO_DEG = 180 / Math.PI;
|
|
|
18
15
|
* radToDeg(0); // 0
|
|
19
16
|
* ```
|
|
20
17
|
*/
|
|
21
|
-
function radToDeg(radians) {
|
|
18
|
+
export function radToDeg(radians) {
|
|
22
19
|
return radians * RAD_TO_DEG;
|
|
23
20
|
}
|
|
24
21
|
//# sourceMappingURL=radToDeg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radToDeg.js","sourceRoot":"","sources":["../../src/math/radToDeg.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"radToDeg.js","sourceRoot":"","sources":["../../src/math/radToDeg.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACvC,OAAO,OAAO,GAAG,UAAU,CAAC;AAC7B,CAAC"}
|
package/dist/math/random.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.random = random;
|
|
4
1
|
/**
|
|
5
2
|
* Generates a random number with both positive and negative values.
|
|
6
3
|
* The result will be between -number and +number.
|
|
@@ -14,7 +11,7 @@ exports.random = random;
|
|
|
14
11
|
* random(5); // Random value between -5 and 5
|
|
15
12
|
* ```
|
|
16
13
|
*/
|
|
17
|
-
function random(number) {
|
|
14
|
+
export function random(number) {
|
|
18
15
|
return (Math.random() - Math.random()) * number;
|
|
19
16
|
}
|
|
20
17
|
//# sourceMappingURL=random.js.map
|
package/dist/math/random.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/math/random.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/math/random.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,MAAM,CAAC,MAAc;IACpC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;AACjD,CAAC"}
|
package/dist/math/randomFloat.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomFloat = randomFloat;
|
|
4
1
|
/**
|
|
5
2
|
* Generates a random floating-point number between min and max.
|
|
6
3
|
*
|
|
@@ -14,7 +11,7 @@ exports.randomFloat = randomFloat;
|
|
|
14
11
|
* randomFloat(1.5, 3.7); // Random float between 1.5 and 3.7
|
|
15
12
|
* ```
|
|
16
13
|
*/
|
|
17
|
-
function randomFloat(min, max) {
|
|
14
|
+
export function randomFloat(min, max) {
|
|
18
15
|
return min + Math.random() * (max - min);
|
|
19
16
|
}
|
|
20
17
|
//# sourceMappingURL=randomFloat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randomFloat.js","sourceRoot":"","sources":["../../src/math/randomFloat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"randomFloat.js","sourceRoot":"","sources":["../../src/math/randomFloat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW;IACnD,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/math/randomInt.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomInt = randomInt;
|
|
4
1
|
/**
|
|
5
2
|
* Generates a random integer between min and max (inclusive).
|
|
6
3
|
*
|
|
@@ -14,7 +11,7 @@ exports.randomInt = randomInt;
|
|
|
14
11
|
* randomInt(0, 100); // Random integer between 0 and 100
|
|
15
12
|
* ```
|
|
16
13
|
*/
|
|
17
|
-
function randomInt(min, max) {
|
|
14
|
+
export function randomInt(min, max) {
|
|
18
15
|
return min + Math.floor(Math.random() * (max - min + 1));
|
|
19
16
|
}
|
|
20
17
|
//# sourceMappingURL=randomInt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randomInt.js","sourceRoot":"","sources":["../../src/math/randomInt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"randomInt.js","sourceRoot":"","sources":["../../src/math/randomInt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,GAAW;IACjD,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|