@jvsoft/utils 0.0.4 → 0.0.6
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/fesm2022/jvsoft-utils-src-functions.mjs +15 -1
- package/fesm2022/jvsoft-utils-src-functions.mjs.map +1 -1
- package/fesm2022/jvsoft-utils-src-interfaces.mjs +1 -9
- package/fesm2022/jvsoft-utils-src-interfaces.mjs.map +1 -1
- package/fesm2022/jvsoft-utils-src-pipes.mjs +25 -1
- package/fesm2022/jvsoft-utils-src-pipes.mjs.map +1 -1
- package/fesm2022/jvsoft-utils.mjs +40 -8
- package/fesm2022/jvsoft-utils.mjs.map +1 -1
- package/functions/email.d.ts +2 -0
- package/functions/mat-form-controls/autocomplete.d.ts +1 -1
- package/functions/public-api.d.ts +1 -0
- package/interfaces/public-api.d.ts +0 -1
- package/package.json +6 -6
- package/pipes/public-api.d.ts +1 -0
- package/pipes/tipo-valor-funcion.pipe.d.ts +9 -0
- package/src/functions/email.d.ts +2 -0
- package/src/functions/mat-form-controls/autocomplete.d.ts +1 -1
- package/src/functions/public-api.d.ts +1 -0
- package/src/interfaces/public-api.d.ts +0 -1
- package/src/pipes/public-api.d.ts +1 -0
- package/src/pipes/tipo-valor-funcion.pipe.d.ts +9 -0
- package/interfaces/otros.d.ts +0 -2
- package/src/interfaces/otros.d.ts +0 -2
|
@@ -450,6 +450,20 @@ function formatearFechaCadena(fecha) {
|
|
|
450
450
|
return new Date(year, month, day);
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
+
function maskEmail(email) {
|
|
454
|
+
const [user, domain] = email.split("@");
|
|
455
|
+
if (user.length <= 2) {
|
|
456
|
+
return `${user[0]}***@${domain}`; // 🔹 Si el usuario es muy corto, no se oculta nada
|
|
457
|
+
}
|
|
458
|
+
if (user.length <= 4) {
|
|
459
|
+
return `${user[0]}***${user.slice(-1)}@${domain}`; // 🔹 Muestra 1 al inicio y 1 al final
|
|
460
|
+
}
|
|
461
|
+
return `${user.slice(0, 2)}***${user.slice(-2)}@${domain}`; // 🔹 Muestra 2 al inicio y 2 al final
|
|
462
|
+
}
|
|
463
|
+
function isEmail(email) {
|
|
464
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
465
|
+
}
|
|
466
|
+
|
|
453
467
|
const mimeTypes = {
|
|
454
468
|
// Imágenes
|
|
455
469
|
'jpg': 'image/jpeg',
|
|
@@ -1394,6 +1408,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
1394
1408
|
args: [{ name: 'noSanitize' }]
|
|
1395
1409
|
}], ctorParameters: () => [{ type: i1.DomSanitizer }] });
|
|
1396
1410
|
|
|
1411
|
+
class TipoValorFuncionPipe {
|
|
1412
|
+
transform(datoParam, defaultValue, ...param) {
|
|
1413
|
+
if (datoParam === undefined || datoParam === null) {
|
|
1414
|
+
return defaultValue;
|
|
1415
|
+
}
|
|
1416
|
+
if (typeof datoParam === 'function') {
|
|
1417
|
+
return datoParam(...param);
|
|
1418
|
+
}
|
|
1419
|
+
return datoParam;
|
|
1420
|
+
}
|
|
1421
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: TipoValorFuncionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1422
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.1.7", ngImport: i0, type: TipoValorFuncionPipe, isStandalone: true, name: "tipoValorFuncion" });
|
|
1423
|
+
}
|
|
1424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: TipoValorFuncionPipe, decorators: [{
|
|
1425
|
+
type: Pipe,
|
|
1426
|
+
args: [{
|
|
1427
|
+
name: 'tipoValorFuncion',
|
|
1428
|
+
standalone: true, // Para usarlo en standalone components
|
|
1429
|
+
}]
|
|
1430
|
+
}] });
|
|
1431
|
+
function tipoValorFuncion(datoParam, defaultValue, ...param) {
|
|
1432
|
+
return new TipoValorFuncionPipe().transform(datoParam, defaultValue, ...param);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1397
1435
|
class ZeroFillPipe {
|
|
1398
1436
|
transform(value, digitos, ...args) {
|
|
1399
1437
|
let s = value + '';
|
|
@@ -1415,13 +1453,7 @@ function zeroFill(value, digitos, ...args) {
|
|
|
1415
1453
|
return new ZeroFillPipe().transform(value, digitos, args);
|
|
1416
1454
|
}
|
|
1417
1455
|
|
|
1418
|
-
//
|
|
1419
|
-
function tipoValorFuncion(datoParam, ...param) {
|
|
1420
|
-
if (typeof datoParam === 'function') {
|
|
1421
|
-
return datoParam(...param);
|
|
1422
|
-
}
|
|
1423
|
-
return datoParam;
|
|
1424
|
-
}
|
|
1456
|
+
// export * from './otros';
|
|
1425
1457
|
|
|
1426
1458
|
/*
|
|
1427
1459
|
* Public API Surface of utils
|
|
@@ -1434,5 +1466,5 @@ function tipoValorFuncion(datoParam, ...param) {
|
|
|
1434
1466
|
* Generated bundle index. Do not edit.
|
|
1435
1467
|
*/
|
|
1436
1468
|
|
|
1437
|
-
export { DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, NoSanitizePipe, ZeroFillPipe, b64Decode, b64Encode, buscarPorCampo, changeSelect, changeSelectApi, changeSelectData, changeSelectDataApi, convertirBytes, dataEnLista, dateDiffString, deepClone, deepMerge, delLocalStorage, desencriptar, downLoadFileStream, encriptar, esNumero, establecerQuitarRequired, formControlIsRequired, formatearFecha, formatearFechaCadena, formatearFechaFormato, generateRandomString, getBrowserName, getCambiarPwd, getDataArchivoFromPath, getFormValidationErrors, getLocalStorage, getUniqueValues, getUniqueValuesByProperty, inicializarVariablesSessionStorage, jwtToken, jwtTokenData, jwtTokenExpiracion, jwtTokenExpiracionFaltante, localStorageKeys, markAsTouchedWithoutEmitEvent, mensajeAlerta, mensajeConfirmacion, mensajeTimer, mensajeToast, mensajesDeError, mensajesErrorFormControl, mostrarValorEnBusqueda, objectPropertiesBoolean, objectPropertiesToType, obtenerMimeType, ordenarArray, ordenarPorPropiedad, ordenarPorPropiedades, roundToDecimal, sanitizarNombreArchivo, seleccionarTextoInput, setCambiarPwd, setJwtTokenData, setLocalStorage, sumarObjetos, sumarPropiedades, tipoValorFuncion, toFormData, verificarRUC, zeroFill };
|
|
1469
|
+
export { DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, NoSanitizePipe, TipoValorFuncionPipe, ZeroFillPipe, b64Decode, b64Encode, buscarPorCampo, changeSelect, changeSelectApi, changeSelectData, changeSelectDataApi, convertirBytes, dataEnLista, dateDiffString, deepClone, deepMerge, delLocalStorage, desencriptar, downLoadFileStream, encriptar, esNumero, establecerQuitarRequired, formControlIsRequired, formatearFecha, formatearFechaCadena, formatearFechaFormato, generateRandomString, getBrowserName, getCambiarPwd, getDataArchivoFromPath, getFormValidationErrors, getLocalStorage, getUniqueValues, getUniqueValuesByProperty, inicializarVariablesSessionStorage, isEmail, jwtToken, jwtTokenData, jwtTokenExpiracion, jwtTokenExpiracionFaltante, localStorageKeys, markAsTouchedWithoutEmitEvent, maskEmail, mensajeAlerta, mensajeConfirmacion, mensajeTimer, mensajeToast, mensajesDeError, mensajesErrorFormControl, mostrarValorEnBusqueda, objectPropertiesBoolean, objectPropertiesToType, obtenerMimeType, ordenarArray, ordenarPorPropiedad, ordenarPorPropiedades, roundToDecimal, sanitizarNombreArchivo, seleccionarTextoInput, setCambiarPwd, setJwtTokenData, setLocalStorage, sumarObjetos, sumarPropiedades, tipoValorFuncion, toFormData, verificarRUC, zeroFill };
|
|
1438
1470
|
//# sourceMappingURL=jvsoft-utils.mjs.map
|