@appartmint/mint 1.2.9 → 1.2.11
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/css/mint.css +1 -0
- package/dist/css/mint.css.map +1 -1
- package/dist/css/mint.min.css +1 -1
- package/dist/css/mint.min.css.map +1 -1
- package/dist/js/imports/util/async.d.ts +11 -0
- package/dist/js/imports/util/async.d.ts.map +1 -0
- package/dist/js/imports/util/index.d.ts +1 -0
- package/dist/js/imports/util/index.d.ts.map +1 -1
- package/dist/js/imports/util/object.d.ts +5 -0
- package/dist/js/imports/util/object.d.ts.map +1 -1
- package/dist/js/imports/util/text.d.ts +6 -0
- package/dist/js/imports/util/text.d.ts.map +1 -1
- package/dist/js/index.js +59 -0
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.min.js +1 -1
- package/dist/js/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/scss/imports/global/_texture.scss +1 -0
- package/src/ts/imports/util/async.ts +12 -0
- package/src/ts/imports/util/index.ts +1 -0
- package/src/ts/imports/util/object.ts +26 -0
- package/src/ts/imports/util/text.ts +9 -0
|
@@ -204,5 +204,31 @@ export abstract class MintObject {
|
|
|
204
204
|
static getKeyByValue(object: any, value: any): string | undefined {
|
|
205
205
|
return Object.keys(object).find((key) => object[key] === value);
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Create a deep copy of an object
|
|
210
|
+
* @recursive
|
|
211
|
+
*/
|
|
212
|
+
static deepClone(object: any): any {
|
|
213
|
+
|
|
214
|
+
// Clone every property
|
|
215
|
+
const clone: any = {};
|
|
216
|
+
for (const key in object) {
|
|
217
|
+
|
|
218
|
+
// Functions
|
|
219
|
+
if (typeof object[key] === 'function') {
|
|
220
|
+
clone[key] = object[key].bind(clone);
|
|
221
|
+
|
|
222
|
+
// Objects
|
|
223
|
+
} else if (object[key] && typeof object[key] === 'object') {
|
|
224
|
+
clone[key] = this.deepClone(object[key]);
|
|
225
|
+
|
|
226
|
+
// Primitives
|
|
227
|
+
} else {
|
|
228
|
+
clone[key] = object[key];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return clone;
|
|
232
|
+
}
|
|
207
233
|
};
|
|
208
234
|
export default MintObject;
|
|
@@ -18,6 +18,15 @@ export abstract class MintText {
|
|
|
18
18
|
.replace(/^\/+|\/+$/g, '') ?? '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Generate a title from a slug
|
|
23
|
+
* @param slug - The slug to generate a title from
|
|
24
|
+
* @returns The title
|
|
25
|
+
*/
|
|
26
|
+
static unslug (slug: string): string {
|
|
27
|
+
return this.titleCase(slug.replace(/[-/]+/g, ' '));
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
/**
|
|
22
31
|
* Format a phone number
|
|
23
32
|
* @param phone - The phone number to format
|