@radiantabyss/vue 3.3.6 → 3.3.7
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/package.json +1 -1
- package/src/Support/Str.js +33 -1
package/package.json
CHANGED
package/src/Support/Str.js
CHANGED
|
@@ -315,7 +315,7 @@ let self = {
|
|
|
315
315
|
}).replace(',', ' @');
|
|
316
316
|
},
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
pretty_time(date) {
|
|
319
319
|
const options = {};
|
|
320
320
|
const parsed_date = new Date(new Date(date + 'Z').toLocaleString('en-US', options)); // Add 'Z' for UTC handling
|
|
321
321
|
|
|
@@ -335,6 +335,38 @@ let self = {
|
|
|
335
335
|
let day = date.getDate();
|
|
336
336
|
return `${date.getFullYear()}-${self.leading_zero(month)}-${self.leading_zero(day)}`;
|
|
337
337
|
},
|
|
338
|
+
|
|
339
|
+
mask(str) {
|
|
340
|
+
if ( !str.length ) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
let visible_chars_left = 0;
|
|
345
|
+
let visible_chars_right = 0;
|
|
346
|
+
|
|
347
|
+
if ( str.length > 6 ) {
|
|
348
|
+
visible_chars_left = 2;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if ( str.length > 10 ) {
|
|
352
|
+
visible_chars_right = 2;
|
|
353
|
+
}
|
|
354
|
+
if ( str.length > 20 ) {
|
|
355
|
+
visible_chars_left = 3;
|
|
356
|
+
visible_chars_left = 3;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
let bullet_count = str.length - visible_chars_left - visible_chars_right;
|
|
360
|
+
if ( bullet_count < 0 ) {
|
|
361
|
+
bullet_count = str.length;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if ( bullet_count > 10 ) {
|
|
365
|
+
bullet_count = 10;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return str.substring(0, visible_chars_left) + '⁕'.repeat(bullet_count) + str.substring(str.length - visible_chars_right);
|
|
369
|
+
},
|
|
338
370
|
}
|
|
339
371
|
|
|
340
372
|
export default self;
|