@mado/utils 0.1.0 → 0.3.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/CHANGELOG.md +13 -0
- package/dist/capitalize.cjs +10 -0
- package/dist/capitalize.cjs.map +1 -0
- package/dist/capitalize.d.cts +3 -0
- package/dist/capitalize.d.ts +3 -0
- package/dist/capitalize.js +8 -0
- package/dist/capitalize.js.map +1 -0
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/isNil.cjs +10 -0
- package/dist/isNil.cjs.map +1 -0
- package/dist/isNil.d.cts +3 -0
- package/dist/isNil.d.ts +3 -0
- package/dist/isNil.js +8 -0
- package/dist/isNil.js.map +1 -0
- package/dist/isObjectLike.cjs +10 -0
- package/dist/isObjectLike.cjs.map +1 -0
- package/dist/isObjectLike.d.cts +3 -0
- package/dist/isObjectLike.d.ts +3 -0
- package/dist/isObjectLike.js +8 -0
- package/dist/isObjectLike.js.map +1 -0
- package/dist/isPlainObject.cjs +16 -0
- package/dist/isPlainObject.cjs.map +1 -0
- package/dist/isPlainObject.d.cts +3 -0
- package/dist/isPlainObject.d.ts +3 -0
- package/dist/isPlainObject.js +14 -0
- package/dist/isPlainObject.js.map +1 -0
- package/package.json +1 -1
- package/src/capitalize.ts +3 -0
- package/src/index.ts +4 -0
- package/src/isNil.ts +3 -0
- package/src/isObjectLike.ts +3 -0
- package/src/isPlainObject.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @mado/utils
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7da15aa: Add isObjectLike and isPlainObject functions
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- ce252f2: - Add capitalize function
|
|
14
|
+
- Add isNil function
|
|
15
|
+
|
|
3
16
|
## 0.1.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/capitalize.ts"],"names":[],"mappings":";AAAO,SAAS,WAAW,KAAqB;AAC9C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,UAAU,CAAC;AACtD","sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/capitalize.ts"],"names":[],"mappings":";AAAO,SAAS,WAAW,KAAqB;AAC9C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,UAAU,CAAC;AACtD","sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var capitalize_cjs = require('./capitalize.cjs');
|
|
3
4
|
var debounce_cjs = require('./debounce.cjs');
|
|
5
|
+
var isNil_cjs = require('./isNil.cjs');
|
|
6
|
+
var isObjectLike_cjs = require('./isObjectLike.cjs');
|
|
7
|
+
var isPlainObject_cjs = require('./isPlainObject.cjs');
|
|
4
8
|
var storageAvailable_cjs = require('./storageAvailable.cjs');
|
|
5
9
|
|
|
6
10
|
|
|
7
11
|
|
|
12
|
+
Object.keys(capitalize_cjs).forEach(function (k) {
|
|
13
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return capitalize_cjs[k]; }
|
|
16
|
+
});
|
|
17
|
+
});
|
|
8
18
|
Object.keys(debounce_cjs).forEach(function (k) {
|
|
9
19
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
10
20
|
enumerable: true,
|
|
11
21
|
get: function () { return debounce_cjs[k]; }
|
|
12
22
|
});
|
|
13
23
|
});
|
|
24
|
+
Object.keys(isNil_cjs).forEach(function (k) {
|
|
25
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return isNil_cjs[k]; }
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
Object.keys(isObjectLike_cjs).forEach(function (k) {
|
|
31
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return isObjectLike_cjs[k]; }
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
Object.keys(isPlainObject_cjs).forEach(function (k) {
|
|
37
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return isPlainObject_cjs[k]; }
|
|
40
|
+
});
|
|
41
|
+
});
|
|
14
42
|
Object.keys(storageAvailable_cjs).forEach(function (k) {
|
|
15
43
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
16
44
|
enumerable: true,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,cAAc","sourcesContent":["export * from './debounce';\nexport * from './storageAvailable';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","sourcesContent":["export * from './capitalize';\nexport * from './debounce';\nexport * from './isNil';\nexport * from './isObjectLike';\nexport * from './isPlainObject';\nexport * from './storageAvailable';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export { capitalize } from './capitalize.cjs';
|
|
1
2
|
export { Cancelable, debounce } from './debounce.cjs';
|
|
3
|
+
export { isNil } from './isNil.cjs';
|
|
4
|
+
export { isObjectLike } from './isObjectLike.cjs';
|
|
5
|
+
export { isPlainObject } from './isPlainObject.cjs';
|
|
2
6
|
export { storageAvailable } from './storageAvailable.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export { capitalize } from './capitalize.js';
|
|
1
2
|
export { Cancelable, debounce } from './debounce.js';
|
|
3
|
+
export { isNil } from './isNil.js';
|
|
4
|
+
export { isObjectLike } from './isObjectLike.js';
|
|
5
|
+
export { isPlainObject } from './isPlainObject.js';
|
|
2
6
|
export { storageAvailable } from './storageAvailable.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export * from './capitalize.js';
|
|
1
2
|
export * from './debounce.js';
|
|
3
|
+
export * from './isNil.js';
|
|
4
|
+
export * from './isObjectLike.js';
|
|
5
|
+
export * from './isPlainObject.js';
|
|
2
6
|
export * from './storageAvailable.js';
|
|
3
7
|
//# sourceMappingURL=out.js.map
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,cAAc","sourcesContent":["export * from './debounce';\nexport * from './storageAvailable';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","sourcesContent":["export * from './capitalize';\nexport * from './debounce';\nexport * from './isNil';\nexport * from './isObjectLike';\nexport * from './isPlainObject';\nexport * from './storageAvailable';\n"]}
|
package/dist/isNil.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isNil.ts"],"names":[],"mappings":";AAAO,SAAS,MAAM,OAA2C;AAC/D,SAAO,SAAS;AAClB","sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"]}
|
package/dist/isNil.d.cts
ADDED
package/dist/isNil.d.ts
ADDED
package/dist/isNil.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isNil.ts"],"names":[],"mappings":";AAAO,SAAS,MAAM,OAA2C;AAC/D,SAAO,SAAS;AAClB","sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isObjectLike.ts"],"names":[],"mappings":";AAAO,SAAS,aAAa,OAAiC;AAC5D,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD","sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isObjectLike.ts"],"names":[],"mappings":";AAAO,SAAS,aAAa,OAAiC;AAC5D,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD","sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isObjectLike_cjs = require('./isObjectLike.cjs');
|
|
4
|
+
|
|
5
|
+
// src/isPlainObject.ts
|
|
6
|
+
function isPlainObject(value) {
|
|
7
|
+
if (!isObjectLike_cjs.isObjectLike(value)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const prototype = Object.getPrototypeOf(value);
|
|
11
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.isPlainObject = isPlainObject;
|
|
15
|
+
//# sourceMappingURL=out.js.map
|
|
16
|
+
//# sourceMappingURL=isPlainObject.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isPlainObject.ts"],"names":[],"mappings":";AAAA,SAAS,oBAAoB;AAEtB,SAAS,cAAgC,OAA4B;AAC1E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,OAAO,eAAe,KAAK;AAE7C,UACG,cAAc,QACb,cAAc,OAAO,aACrB,OAAO,eAAe,SAAS,MAAM,SACvC,EAAE,OAAO,eAAe,UACxB,EAAE,OAAO,YAAY;AAEzB","sourcesContent":["import { isObjectLike } from './isObjectLike';\n\nexport function isPlainObject<T extends object>(value: unknown): value is T {\n if (!isObjectLike(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n\n return (\n (prototype === null ||\n prototype === Object.prototype ||\n Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n );\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isObjectLike } from './isObjectLike.js';
|
|
2
|
+
|
|
3
|
+
// src/isPlainObject.ts
|
|
4
|
+
function isPlainObject(value) {
|
|
5
|
+
if (!isObjectLike(value)) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const prototype = Object.getPrototypeOf(value);
|
|
9
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { isPlainObject };
|
|
13
|
+
//# sourceMappingURL=out.js.map
|
|
14
|
+
//# sourceMappingURL=isPlainObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isPlainObject.ts"],"names":[],"mappings":";AAAA,SAAS,oBAAoB;AAEtB,SAAS,cAAgC,OAA4B;AAC1E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,OAAO,eAAe,KAAK;AAE7C,UACG,cAAc,QACb,cAAc,OAAO,aACrB,OAAO,eAAe,SAAS,MAAM,SACvC,EAAE,OAAO,eAAe,UACxB,EAAE,OAAO,YAAY;AAEzB","sourcesContent":["import { isObjectLike } from './isObjectLike';\n\nexport function isPlainObject<T extends object>(value: unknown): value is T {\n if (!isObjectLike(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n\n return (\n (prototype === null ||\n prototype === Object.prototype ||\n Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n );\n}\n"]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/isNil.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isObjectLike } from './isObjectLike';
|
|
2
|
+
|
|
3
|
+
export function isPlainObject<T extends object>(value: unknown): value is T {
|
|
4
|
+
if (!isObjectLike(value)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const prototype = Object.getPrototypeOf(value);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
(prototype === null ||
|
|
12
|
+
prototype === Object.prototype ||
|
|
13
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
14
|
+
!(Symbol.toStringTag in value) &&
|
|
15
|
+
!(Symbol.iterator in value)
|
|
16
|
+
);
|
|
17
|
+
}
|