@zajno/common 2.2.3 → 2.2.4
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/models/Model.d.ts +2 -2
- package/models/Model.d.ts.map +1 -1
- package/package.json +25 -21
- package/storage/abstractions.d.ts +2 -2
- package/storage/abstractions.d.ts.map +1 -1
- package/storage/asyncWrapper.d.ts +1 -1
- package/storage/keyStorage.d.ts +4 -4
- package/storage/keyStorage.d.ts.map +1 -1
- package/storage/keyStorage.js.map +1 -1
- package/types/arrays.d.ts +4 -0
- package/types/arrays.d.ts.map +1 -0
- package/types/arrays.js +12 -0
- package/types/arrays.js.map +1 -0
- package/validation/emails.d.ts +2 -0
- package/validation/emails.d.ts.map +1 -1
- package/validation/emails.js +4 -1
- package/validation/emails.js.map +1 -1
package/models/Model.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IValueModel } from './types';
|
|
2
2
|
import { Getter } from '../types/getter';
|
|
3
|
-
export declare class Model<T> implements IValueModel<T> {
|
|
3
|
+
export declare class Model<T> implements IValueModel<T | null> {
|
|
4
4
|
private _value;
|
|
5
5
|
private readonly _defaultValue;
|
|
6
|
-
constructor(v?: Getter<T
|
|
6
|
+
constructor(v?: Getter<T | null>);
|
|
7
7
|
get value(): T;
|
|
8
8
|
set value(v: T);
|
|
9
9
|
readonly setValue: (value: T | undefined | null) => void;
|
package/models/Model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/models/Model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,qBAAa,KAAK,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/models/Model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,qBAAa,KAAK,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC;IAClD,OAAO,CAAC,MAAM,CAAuB;IAErC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;gBAErC,CAAC,GAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAQ;IAKtC,IAAW,KAAK,IACI,CAAC,CADsB;IAC3C,IAAW,KAAK,CAAC,CAAC,EAAE,CAAC,EAEpB;IAED,SAAgB,QAAQ,UAAW,CAAC,GAAG,SAAS,GAAG,IAAI,UAErD;IAEF,SAAgB,KAAK,aAMnB;CACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zajno/common",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "Zajno's re-usable utilities for JS/TS projects",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -14,36 +14,40 @@
|
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/Zajno/common-utils/tree/main/packages/common#readme",
|
|
16
16
|
"scripts": {
|
|
17
|
-
"clean": "
|
|
18
|
-
"dev": "
|
|
19
|
-
"build": "
|
|
20
|
-
"build:clean": "
|
|
21
|
-
"build:
|
|
22
|
-
"
|
|
23
|
-
"publish:
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
17
|
+
"clean": "scripty",
|
|
18
|
+
"dev": "scripty",
|
|
19
|
+
"build": "scripty",
|
|
20
|
+
"build:clean": "scripty",
|
|
21
|
+
"build:w": "scripty",
|
|
22
|
+
"publish:local": "scripty",
|
|
23
|
+
"publish:from-dist": "scripty",
|
|
24
|
+
"build:full": "scripty",
|
|
25
|
+
"bundle": "scripty",
|
|
26
|
+
"lint": "scripty",
|
|
27
|
+
"test": "scripty"
|
|
28
|
+
},
|
|
29
|
+
"config": {
|
|
30
|
+
"scripty": {
|
|
31
|
+
"path": "../scripts"
|
|
32
|
+
}
|
|
29
33
|
},
|
|
30
34
|
"dependencies": {},
|
|
31
35
|
"devDependencies": {
|
|
32
36
|
"@faker-js/faker": "^8.3.1",
|
|
33
|
-
"@types/node": "^18.19.
|
|
34
|
-
"@zajno/eslint-config": "^3.0.
|
|
37
|
+
"@types/node": "^18.19.3",
|
|
38
|
+
"@zajno/eslint-config": "^3.0.1",
|
|
35
39
|
"cpy-cli": "^5.0.0",
|
|
36
|
-
"eslint": "^8.
|
|
37
|
-
"fast-check": "^3.
|
|
40
|
+
"eslint": "^8.56.0",
|
|
41
|
+
"fast-check": "^3.15.0",
|
|
38
42
|
"jest-extended": "^4.0.2",
|
|
39
43
|
"rimraf": "^5.0.5",
|
|
40
|
-
"ts-node": "^10.9.
|
|
44
|
+
"ts-node": "^10.9.2",
|
|
41
45
|
"tslib": "^2.6.2",
|
|
42
|
-
"typescript": "^5.3.
|
|
43
|
-
"vitest": "^1.0.
|
|
46
|
+
"typescript": "^5.3.3",
|
|
47
|
+
"vitest": "^1.0.4"
|
|
44
48
|
},
|
|
45
49
|
"peerDependencies": {
|
|
46
|
-
"tslib": "^2.6"
|
|
50
|
+
"tslib": "^2.6.2"
|
|
47
51
|
},
|
|
48
52
|
"files": [
|
|
49
53
|
"LICENSE",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export interface IStorage {
|
|
2
|
-
getValue(key: string): Promise<string>;
|
|
2
|
+
getValue(key: string): Promise<string | null>;
|
|
3
3
|
setValue(key: string, value: string): Promise<void>;
|
|
4
4
|
hasValue(key: string): Promise<boolean>;
|
|
5
5
|
remove(key: string): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
export interface IStorageSync {
|
|
8
|
-
getValue(key: string): string;
|
|
8
|
+
getValue(key: string): string | null;
|
|
9
9
|
setValue(key: string, value: string): void;
|
|
10
10
|
removeValue(key: string): boolean;
|
|
11
11
|
hasValue(key: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractions.d.ts","sourceRoot":"","sources":["../../src/storage/abstractions.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,QAAQ;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"abstractions.d.ts","sourceRoot":"","sources":["../../src/storage/abstractions.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,QAAQ;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { IStorage, IStorageSync } from './abstractions';
|
|
|
2
2
|
export declare class StorageAsyncWrapper implements IStorage {
|
|
3
3
|
readonly webStorage: IStorageSync;
|
|
4
4
|
constructor(webStorage: IStorageSync);
|
|
5
|
-
getValue(key: string): Promise<string>;
|
|
5
|
+
getValue(key: string): Promise<string | null>;
|
|
6
6
|
setValue(key: string, value: string): Promise<void>;
|
|
7
7
|
hasValue(key: string): Promise<boolean>;
|
|
8
8
|
remove(key: string): Promise<void>;
|
package/storage/keyStorage.d.ts
CHANGED
|
@@ -3,17 +3,17 @@ export declare class KeyStorage {
|
|
|
3
3
|
readonly storage: IStorageSync;
|
|
4
4
|
readonly key: string;
|
|
5
5
|
constructor(storage: IStorageSync, key: string);
|
|
6
|
-
get value(): string;
|
|
6
|
+
get value(): string | null;
|
|
7
7
|
set value(v: string);
|
|
8
8
|
clean(): void;
|
|
9
9
|
getHasValue(): boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare class KeyStorageConverted<T> {
|
|
12
12
|
readonly input: (v: T) => string;
|
|
13
|
-
readonly output: (s: string) => T;
|
|
13
|
+
readonly output: (s: string | null) => T;
|
|
14
14
|
private readonly _storage;
|
|
15
|
-
constructor(storage: IStorageSync, key: string, input?: (v: T) => string, output?: (s: string) => T);
|
|
16
|
-
get value(): T;
|
|
15
|
+
constructor(storage: IStorageSync, key: string, input?: (v: T) => string, output?: (s: string | null) => T);
|
|
16
|
+
get value(): T | null;
|
|
17
17
|
set value(v: T);
|
|
18
18
|
clean(): void;
|
|
19
19
|
getHasValue(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyStorage.d.ts","sourceRoot":"","sources":["../../src/storage/keyStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,UAAU;IACP,QAAQ,CAAC,OAAO,EAAE,YAAY;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM;gBAA3C,OAAO,EAAE,YAAY,EAAW,GAAG,EAAE,MAAM;IAEhE,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"keyStorage.d.ts","sourceRoot":"","sources":["../../src/storage/keyStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,UAAU;IACP,QAAQ,CAAC,OAAO,EAAE,YAAY;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM;gBAA3C,OAAO,EAAE,YAAY,EAAW,GAAG,EAAE,MAAM;IAEhE,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAA4C;IACtE,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,EAAyC;IAErD,KAAK;IAIL,WAAW;CAGrB;AAED,qBAAa,mBAAmB,CAAC,CAAC;IAM1B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM;IAChC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,CAAC;IAN5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;gBAGlC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,MAAM,EACF,KAAK,GAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAiC,EAClD,MAAM,GAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,CAAuC;IAKlF,IAAI,KAAK,IAAI,CAAC,GAAG,IAAI,CAA6C;IAClE,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAA0C;IAEjD,KAAK;IAIL,WAAW;CAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyStorage.js","sourceRoot":"","sources":["../../src/storage/keyStorage.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IACE;IAAgC;IAArD,YAAqB,OAAqB,EAAW,GAAW;QAA3C,YAAO,GAAP,OAAO,CAAc;QAAW,QAAG,GAAH,GAAG,CAAQ;IAAI,CAAC;IAErE,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"keyStorage.js","sourceRoot":"","sources":["../../src/storage/keyStorage.ts"],"names":[],"mappings":";;;AAEA,MAAa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C;IAEjD,KAAK;QACR,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC;CACJ;AAtBD,kDAsBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../src/types/arrays.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAEhE;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAEhF,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAEtD"}
|
package/types/arrays.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truthy = exports.nonNullable = void 0;
|
|
4
|
+
function nonNullable(value) {
|
|
5
|
+
return value !== null && value !== undefined;
|
|
6
|
+
}
|
|
7
|
+
exports.nonNullable = nonNullable;
|
|
8
|
+
function truthy(value) {
|
|
9
|
+
return !!value;
|
|
10
|
+
}
|
|
11
|
+
exports.truthy = truthy;
|
|
12
|
+
//# sourceMappingURL=arrays.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../src/types/arrays.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAI,KAAQ;IACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AACjD,CAAC;AAFD,kCAEC;AAID,SAAgB,MAAM,CAAI,KAAQ;IAC9B,OAAO,CAAC,CAAC,KAAK,CAAC;AACnB,CAAC;AAFD,wBAEC"}
|
package/validation/emails.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/validation/emails.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/validation/emails.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;AACpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AACjE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC"}
|
package/validation/emails.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareEmail = void 0;
|
|
4
4
|
function prepareEmail(email) {
|
|
5
|
-
|
|
5
|
+
if (!email) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return email.toLowerCase()
|
|
6
9
|
.replace(/ /gi, '');
|
|
7
10
|
}
|
|
8
11
|
exports.prepareEmail = prepareEmail;
|
package/validation/emails.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emails.js","sourceRoot":"","sources":["../../src/validation/emails.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"emails.js","sourceRoot":"","sources":["../../src/validation/emails.ts"],"names":[],"mappings":";;;AAIA,SAAgB,YAAY,CAAC,KAAgC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC,WAAW,EAAE;SACrB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC5B,CAAC;AAPD,oCAOC"}
|