Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

h3lp

Package Overview
Dependencies
Maintainers
0
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h3lp - npm Package Compare versions

Comparing version 1.12.1 to 2.0.0

application/array.d.ts.map

1

application/array.d.ts

@@ -10,1 +10,2 @@ export interface IArrayHelper {

}
//# sourceMappingURL=array.d.ts.map

3

application/array.js

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=array.js.map

@@ -1,2 +0,2 @@

import { ICache } from '../domain';
import { ICache } from '../domain/index';
export declare class MemoryCache<K, T> implements ICache<K, T> {

@@ -9,1 +9,2 @@ private readonly map;

}
//# sourceMappingURL=cache.d.ts.map

@@ -1,6 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryCache = void 0;
class MemoryCache {
// eslint-disable-next-line no-useless-constructor
export class MemoryCache {
constructor(map = new Map()) {

@@ -19,3 +15,2 @@ this.map = map;

}
exports.MemoryCache = MemoryCache;
//# sourceMappingURL=cache.js.map

@@ -23,1 +23,2 @@ /// <reference types="node" />

}
//# sourceMappingURL=fs.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=fs.js.map

@@ -1,2 +0,2 @@

import { IUtils, IValidator, IFsHelper, IHttpHelper, IObjectHelper, IStringHelper, ITestHelper, IArrayHelper } from '.';
import { IUtils, IValidator, IFsHelper, IHttpHelper, IObjectHelper, IStringHelper, ITestHelper, IArrayHelper } from './index';
export declare class H3lp {

@@ -13,1 +13,2 @@ readonly utils: IUtils;

}
//# sourceMappingURL=h3lp.d.ts.map

@@ -1,6 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.H3lp = void 0;
class H3lp {
// eslint-disable-next-line no-useless-constructor
export class H3lp {
constructor(utils, val, fs, http, obj, str, test, array) {

@@ -17,3 +13,2 @@ this.utils = utils;

}
exports.H3lp = H3lp;
//# sourceMappingURL=h3lp.js.map

@@ -6,1 +6,2 @@ export interface IHttpHelper {

}
//# sourceMappingURL=http.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=http.js.map

@@ -11,1 +11,2 @@ export * from './utils';

export * from './cache';
//# sourceMappingURL=index.d.ts.map

@@ -1,27 +0,11 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./utils"), exports);
__exportStar(require("./validator"), exports);
__exportStar(require("./fs"), exports);
__exportStar(require("./http"), exports);
__exportStar(require("./object"), exports);
__exportStar(require("./string"), exports);
__exportStar(require("./test"), exports);
__exportStar(require("./array"), exports);
__exportStar(require("./h3lp"), exports);
__exportStar(require("./cache"), exports);
export * from './utils';
export * from './validator';
export * from './fs';
export * from './http';
export * from './object';
export * from './string';
export * from './test';
export * from './array';
export * from './h3lp';
export * from './cache';
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { Delta, DeltaOptions } from '../domain';
import { Delta, DeltaOptions } from '../domain/index';
export interface ObjectEqualOptions {

@@ -25,1 +25,2 @@ strict?: boolean;

}
//# sourceMappingURL=object.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=object.js.map

@@ -21,1 +21,2 @@ import { NormalizeOptions } from '../domain/base';

}
//# sourceMappingURL=string.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=string.js.map

@@ -1,2 +0,2 @@

import { IBuildTest, TestBuildInfo } from '../domain';
import { IBuildTest, TestBuildInfo } from '../domain/index';
export interface ITestSuiteBuilder {

@@ -14,1 +14,2 @@ add(test: IBuildTest): ITestSuiteBuilder;

}
//# sourceMappingURL=test.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=test.js.map

@@ -1,2 +0,2 @@

import { IReplacer } from '../domain';
import { IReplacer } from '../domain/index';
import { IObjectHelper } from './object';

@@ -33,1 +33,2 @@ export interface IContextReplacer extends IReplacer {

}
//# sourceMappingURL=utils.d.ts.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextReplacer = exports.EnvironmentVariableReplacer = void 0;
class EnvironmentVariableReplacer {
export class EnvironmentVariableReplacer {
replace(match) {

@@ -9,5 +6,3 @@ return process.env[match];

}
exports.EnvironmentVariableReplacer = EnvironmentVariableReplacer;
class ContextReplacer {
// eslint-disable-next-line no-useless-constructor
export class ContextReplacer {
constructor(obj) {

@@ -24,3 +19,2 @@ this.obj = obj;

}
exports.ContextReplacer = ContextReplacer;
//# sourceMappingURL=utils.js.map

@@ -29,1 +29,2 @@ export interface IValidator {

}
//# sourceMappingURL=validator.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=validator.js.map

@@ -13,1 +13,2 @@ export interface ICache<K, T> {

}
//# sourceMappingURL=base.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=base.js.map
export declare function Sealed(constructor: Function): void;
export declare function Service(name: string): (constructor: Function) => void;
export declare function Autowired(name: string): (target: any, propertyKey: string) => void;
//# sourceMappingURL=decorators.d.ts.map

@@ -1,18 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Autowired = exports.Service = exports.Sealed = void 0;
/* eslint-disable @typescript-eslint/ban-types */
const factory_1 = require("./factory");
function Sealed(constructor) {
import { Factory } from './factory';
export function Sealed(constructor) {
Object.seal(constructor);
Object.seal(constructor.prototype);
}
exports.Sealed = Sealed;
function Service(name) {
export function Service(name) {
return function (constructor) {
factory_1.Factory.add(name, Object.create(constructor.prototype));
Factory.add(name, Object.create(constructor.prototype));
};
}
exports.Service = Service;
function Autowired(name) {
export function Autowired(name) {
return function (target, propertyKey) {

@@ -22,3 +16,3 @@ let instance;

if (instance === undefined) {
instance = factory_1.Factory.get(name);
instance = Factory.get(name);
}

@@ -32,3 +26,2 @@ return instance;

}
exports.Autowired = Autowired;
//# sourceMappingURL=decorators.js.map

@@ -35,1 +35,2 @@ export interface NewValue {

}
//# sourceMappingURL=delta.d.ts.map

@@ -1,8 +0,3 @@

"use strict";
/* eslint-disable no-use-before-define */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Delta = void 0;
class Delta {
export class Delta {
}
exports.Delta = Delta;
//# sourceMappingURL=delta.js.map

@@ -6,1 +6,2 @@ export declare class Factory {

}
//# sourceMappingURL=factory.d.ts.map

@@ -1,17 +0,6 @@

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var Factory_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Factory = void 0;
const decorators_1 = require("./decorators");
let Factory = Factory_1 = class Factory {
export class Factory {
static add(service, instance) {
const names = service.split('.');
const level = names.length - 1;
let data = Factory_1.instances;
let data = Factory.instances;
for (let i = 0; i < names.length; i++) {

@@ -31,3 +20,3 @@ const name = names[i];

const names = service.split('.');
let value = Factory_1.instances;
let value = Factory.instances;
for (const name of names) {

@@ -43,8 +32,4 @@ if (value[name] === undefined) {

}
};
exports.Factory = Factory;
}
Factory.instances = {};
exports.Factory = Factory = Factory_1 = __decorate([
decorators_1.Sealed
], Factory);
//# sourceMappingURL=factory.js.map

@@ -6,1 +6,2 @@ export * from './base';

export * from './factory';
//# sourceMappingURL=index.d.ts.map

@@ -1,22 +0,6 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./base"), exports);
__exportStar(require("./delta"), exports);
__exportStar(require("./decorators"), exports);
__exportStar(require("./test"), exports);
__exportStar(require("./factory"), exports);
export * from './base';
export * from './delta';
export * from './decorators';
export * from './test';
export * from './factory';
//# sourceMappingURL=index.js.map

@@ -44,1 +44,2 @@ export interface Test {

}
//# sourceMappingURL=test.d.ts.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=test.js.map

@@ -1,4 +0,5 @@

export declare const h3lp: import("./application").H3lp;
export * from './domain';
export * from './application';
export * from './infrastructure';
export declare const h3lp: import("./application/h3lp").H3lp;
export * from './domain/index';
export * from './application/index';
export * from './infrastructure/index';
//# sourceMappingURL=index.d.ts.map

@@ -1,23 +0,6 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.h3lp = void 0;
const builder_1 = require("./infrastructure/builder");
exports.h3lp = new builder_1.H3lpBuilder().build();
__exportStar(require("./domain"), exports);
__exportStar(require("./application"), exports);
__exportStar(require("./infrastructure"), exports);
import { H3lpBuilder } from './infrastructure/builder';
export const h3lp = new H3lpBuilder().build();
export * from './domain/index';
export * from './application/index';
export * from './infrastructure/index';
//# sourceMappingURL=index.js.map

@@ -1,44 +0,11 @@

import { IArrayHelper } from '../application';
import { IArrayHelper } from '../application/index';
export declare class ArrayHelper implements IArrayHelper {
/**
* Gets an array with no duplicates
* @param array array
* @returns array with no duplicates
*/
unique(array: any[]): any[];
/**
* Union of two arrays
* @param array1
* @param array2
* @returns
*/
union(array1: any[], array2: any[]): any[];
/**
* Intersection of two arrays
* @param array1
* @param array2
* @returns
*/
intersection(array1: any[], array2: any[]): any[];
/**
* Left difference of two arrays: arr1 - arr2
* @param array1
* @param array2
* @returns
*/
difference(array1: any[], array2: any[]): any[];
/**
* Symmetric difference of two arrays: ( arr1 - arr2 ) U ( arr2 - arr1 )
* @param array1
* @param array2
* @returns
*/
symmetricDifference(array1: any[], array2: any[]): any[];
/**
* Shuffle an array
* @param array
* @returns
*/
shuffle(array: any[]): any[];
chunks(array: any[], size: number): any[][];
}
//# sourceMappingURL=array.d.ts.map

@@ -1,61 +0,17 @@

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArrayHelper = void 0;
const domain_1 = require("../domain");
let ArrayHelper = class ArrayHelper {
/**
* Gets an array with no duplicates
* @param array array
* @returns array with no duplicates
*/
export class ArrayHelper {
unique(array) {
return [...new Set(array)];
}
/**
* Union of two arrays
* @param array1
* @param array2
* @returns
*/
union(array1, array2) {
return [...new Set(array1.concat(array2))];
}
/**
* Intersection of two arrays
* @param array1
* @param array2
* @returns
*/
intersection(array1, array2) {
return array1.filter(x => array2.includes(x));
}
/**
* Left difference of two arrays: arr1 - arr2
* @param array1
* @param array2
* @returns
*/
difference(array1, array2) {
return array1.filter(x => !array2.includes(x));
}
/**
* Symmetric difference of two arrays: ( arr1 - arr2 ) U ( arr2 - arr1 )
* @param array1
* @param array2
* @returns
*/
symmetricDifference(array1, array2) {
return this.union(this.difference(array1, array2), this.difference(array2, array1));
}
/**
* Shuffle an array
* @param array
* @returns
*/
shuffle(array) {

@@ -72,7 +28,3 @@ return array.sort(() => Math.random() - 0.5);

}
};
exports.ArrayHelper = ArrayHelper;
exports.ArrayHelper = ArrayHelper = __decorate([
(0, domain_1.Service)('h3lp.array')
], ArrayHelper);
}
//# sourceMappingURL=array.js.map

@@ -1,4 +0,5 @@

import { H3lp } from '../application';
import { H3lp } from '../application/index';
export declare class H3lpBuilder {
build(): H3lp;
}
//# sourceMappingURL=builder.d.ts.map

@@ -1,27 +0,23 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.H3lpBuilder = void 0;
const application_1 = require("../application");
const array_1 = require("./array");
const fs_1 = require("./fs");
const http_1 = require("./http");
const object_1 = require("./object");
const string_1 = require("./string");
const test_1 = require("./test");
const utils_1 = require("./utils");
const validator_1 = require("./validator");
class H3lpBuilder {
import { H3lp } from '../application/index';
import { ArrayHelper } from './array';
import { FsHelper } from './fs';
import { HttpHelper } from './http';
import { ObjectHelper } from './object';
import { StringHelper } from './string';
import { TestHelper } from './test';
import { Utils } from './utils';
import { Validator } from './validator';
export class H3lpBuilder {
build() {
const val = new validator_1.Validator();
const str = new string_1.StringHelper(val);
const array = new array_1.ArrayHelper();
const fs = new fs_1.FsHelper();
const http = new http_1.HttpHelper(str);
const obj = new object_1.ObjectHelper(http, val);
const utils = new utils_1.Utils(val, obj);
const test = new test_1.TestHelper(utils, fs, str, obj);
return new application_1.H3lp(utils, val, fs, http, obj, str, test, array);
const val = new Validator();
const str = new StringHelper(val);
const array = new ArrayHelper();
const fs = new FsHelper();
const http = new HttpHelper(str);
const obj = new ObjectHelper(http, val);
const utils = new Utils(val, obj);
const test = new TestHelper(utils, fs, str, obj);
return new H3lp(utils, val, fs, http, obj, str, test, array);
}
}
exports.H3lpBuilder = H3lpBuilder;
//# sourceMappingURL=builder.js.map

@@ -1,2 +0,2 @@

import { ICache } from '../domain';
import { ICache } from '../domain/index';
export declare class MemoryCache<K, T> implements ICache<K, T> {

@@ -9,1 +9,2 @@ private readonly map;

}
//# sourceMappingURL=cache.d.ts.map

@@ -1,6 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryCache = void 0;
class MemoryCache {
// eslint-disable-next-line no-useless-constructor
export class MemoryCache {
constructor(map = new Map()) {

@@ -19,3 +15,2 @@ this.map = map;

}
exports.MemoryCache = MemoryCache;
//# sourceMappingURL=cache.js.map
/// <reference types="node" />
/// <reference types="node" />
import fs from 'fs';
import { IFsHelper } from '../application';
import { IFsHelper } from '../application/index';
export declare class FsHelper implements IFsHelper {

@@ -24,1 +24,2 @@ exists(sourcePath: string): Promise<boolean>;

}
//# sourceMappingURL=fs.d.ts.map

@@ -1,38 +0,14 @@

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FsHelper = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const domain_1 = require("../domain");
let FsHelper = class FsHelper {
exists(sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
const fullPath = this.resolve(sourcePath);
return new Promise((resolve) => {
fs_1.default.access(fullPath, (err) => {
if (err) {
resolve(false);
}
else {
resolve(true);
}
});
import fs from 'fs';
import path from 'path';
export class FsHelper {
async exists(sourcePath) {
const fullPath = this.resolve(sourcePath);
return new Promise((resolve) => {
fs.access(fullPath, (err) => {
if (err) {
resolve(false);
}
else {
resolve(true);
}
});

@@ -42,34 +18,30 @@ });

dirname(sourcePath) {
return path_1.default.dirname(sourcePath);
return path.dirname(sourcePath);
}
basename(sourcePath) {
return path_1.default.basename(sourcePath);
return path.basename(sourcePath);
}
join(...paths) {
return path_1.default.join(...paths);
return path.join(...paths);
}
extname(sourcePath) {
return path_1.default.extname(sourcePath);
return path.extname(sourcePath);
}
move(sourcePath, destPath) {
return __awaiter(this, void 0, void 0, function* () {
const _sourcePath = this.resolve(sourcePath);
const _destPath = this.resolve(destPath);
if (!(yield this.exists(_sourcePath))) {
throw new Error(`not exists ${sourcePath}`);
}
return new Promise((resolve, reject) => {
fs_1.default.rename(_sourcePath, _destPath, err => err ? reject(err) : resolve());
});
async move(sourcePath, destPath) {
const _sourcePath = this.resolve(sourcePath);
const _destPath = this.resolve(destPath);
if (!await this.exists(_sourcePath)) {
throw new Error(`not exists ${sourcePath}`);
}
return new Promise((resolve, reject) => {
fs.rename(_sourcePath, _destPath, err => err ? reject(err) : resolve());
});
}
create(sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
const fullPath = this.resolve(sourcePath);
if (yield this.exists(fullPath)) {
return;
}
return new Promise((resolve, reject) => {
fs_1.default.mkdir(fullPath, { recursive: true }, err => err ? reject(err) : resolve());
});
async create(sourcePath) {
const fullPath = this.resolve(sourcePath);
if (await this.exists(fullPath)) {
return;
}
return new Promise((resolve, reject) => {
fs.mkdir(fullPath, { recursive: true }, err => err ? reject(err) : resolve());
});

@@ -80,3 +52,3 @@ }

if (_source.startsWith('.')) {
return path_1.default.join(process.cwd(), source);
return path.join(process.cwd(), source);
}

@@ -88,115 +60,93 @@ if (_source.startsWith('~')) {

}
read(filePath) {
return __awaiter(this, void 0, void 0, function* () {
const fullPath = this.resolve(filePath);
if (!(yield this.exists(fullPath))) {
return null;
}
return new Promise((resolve, reject) => {
fs_1.default.readFile(fullPath, (err, data) => err ? reject(err) : resolve(data.toString('utf8')));
});
async read(filePath) {
const fullPath = this.resolve(filePath);
if (!await this.exists(fullPath)) {
return null;
}
return new Promise((resolve, reject) => {
fs.readFile(fullPath, (err, data) => err ? reject(err) : resolve(data.toString('utf8')));
});
}
remove(sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
const fullPath = this.resolve(sourcePath);
if (!(yield this.exists(fullPath))) {
async remove(sourcePath) {
const fullPath = this.resolve(sourcePath);
if (!await this.exists(fullPath)) {
return;
}
return new Promise((resolve, reject) => {
fs.unlink(fullPath, err => err ? reject(err) : resolve());
});
}
async removeDir(directoryPath) {
try {
const stats = await this.lstat(directoryPath);
if (!stats.isDirectory()) {
await this.remove(directoryPath);
return;
}
const files = await this.readdir(directoryPath);
await Promise.all(files.map(async (file) => {
const filePath = path.join(directoryPath, file);
await this.removeDir(filePath);
}));
return new Promise((resolve, reject) => {
fs_1.default.unlink(fullPath, err => err ? reject(err) : resolve());
fs.rmdir(directoryPath, err => err ? reject(err) : resolve());
});
});
}
catch (err) {
console.error(`Error removing directory ${directoryPath}: ${err}`);
}
}
removeDir(directoryPath) {
return __awaiter(this, void 0, void 0, function* () {
try {
const stats = yield this.lstat(directoryPath);
if (!stats.isDirectory()) {
yield this.remove(directoryPath);
return;
}
const files = yield this.readdir(directoryPath);
yield Promise.all(files.map((file) => __awaiter(this, void 0, void 0, function* () {
const filePath = path_1.default.join(directoryPath, file);
yield this.removeDir(filePath);
})));
return new Promise((resolve, reject) => {
fs_1.default.rmdir(directoryPath, err => err ? reject(err) : resolve());
});
}
catch (err) {
console.error(`Error removing directory ${directoryPath}: ${err}`);
}
async copy(src, dest) {
const _src = this.resolve(src);
const _dest = this.resolve(dest);
if (!await this.exists(_src)) {
throw new Error(`not exists ${src}`);
}
return new Promise((resolve, reject) => {
fs.copyFile(_src, _dest, err => err ? reject(err) : resolve());
});
}
copy(src, dest) {
return __awaiter(this, void 0, void 0, function* () {
const _src = this.resolve(src);
const _dest = this.resolve(dest);
if (!(yield this.exists(_src))) {
throw new Error(`not exists ${src}`);
}
return new Promise((resolve, reject) => {
fs_1.default.copyFile(_src, _dest, err => err ? reject(err) : resolve());
});
async write(sourcePath, content) {
const filePath = this.resolve(sourcePath);
const dir = path.dirname(filePath);
if (!await this.exists(dir)) {
await this.create(dir);
}
return new Promise((resolve, reject) => {
fs.writeFile(filePath, content, { encoding: 'utf8' }, err => err ? reject(err) : resolve());
});
}
write(sourcePath, content) {
return __awaiter(this, void 0, void 0, function* () {
const filePath = this.resolve(sourcePath);
const dir = path_1.default.dirname(filePath);
if (!(yield this.exists(dir))) {
yield this.create(dir);
}
return new Promise((resolve, reject) => {
fs_1.default.writeFile(filePath, content, { encoding: 'utf8' }, err => err ? reject(err) : resolve());
});
async writeBinary(sourcePath, content) {
const filePath = this.resolve(sourcePath);
const dir = path.dirname(filePath);
if (!await this.exists(dir)) {
await this.create(dir);
}
return new Promise((resolve, reject) => {
fs.writeFile(filePath, content, err => err ? reject(err) : resolve());
});
}
writeBinary(sourcePath, content) {
return __awaiter(this, void 0, void 0, function* () {
const filePath = this.resolve(sourcePath);
const dir = path_1.default.dirname(filePath);
if (!(yield this.exists(dir))) {
yield this.create(dir);
}
return new Promise((resolve, reject) => {
fs_1.default.writeFile(filePath, content, err => err ? reject(err) : resolve());
});
async lstat(sourcePath) {
const fullPath = this.resolve(sourcePath);
return new Promise((resolve, reject) => {
fs.lstat(fullPath, (err, stats) => err
? reject(err)
: resolve(stats));
});
}
lstat(sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
const fullPath = this.resolve(sourcePath);
return new Promise((resolve, reject) => {
fs_1.default.lstat(fullPath, (err, stats) => err
? reject(err)
: resolve(stats));
});
async readdir(sourcePath) {
const fullPath = this.resolve(sourcePath);
return new Promise((resolve, reject) => {
fs.readdir(fullPath, (err, items) => err
? reject(err)
: resolve(items));
});
}
readdir(sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
const fullPath = this.resolve(sourcePath);
return new Promise((resolve, reject) => {
fs_1.default.readdir(fullPath, (err, items) => err
? reject(err)
: resolve(items));
});
});
async isDirectory(sourcePath) {
if (await this.exists(sourcePath)) {
return fs.lstatSync(sourcePath).isDirectory();
}
return path.parse(sourcePath).ext.toLocaleLowerCase() === '';
}
isDirectory(sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
if (yield this.exists(sourcePath)) {
return fs_1.default.lstatSync(sourcePath).isDirectory();
}
return path_1.default.parse(sourcePath).ext.toLocaleLowerCase() === '';
});
}
};
exports.FsHelper = FsHelper;
exports.FsHelper = FsHelper = __decorate([
(0, domain_1.Service)('h3lp.fs')
], FsHelper);
}
//# sourceMappingURL=fs.js.map

@@ -1,2 +0,2 @@

import { IHttpHelper, IStringHelper } from '../application';
import { IHttpHelper, IStringHelper } from '../application/index';
export declare class HttpHelper implements IHttpHelper {

@@ -9,1 +9,2 @@ private readonly str;

}
//# sourceMappingURL=http.d.ts.map

@@ -1,55 +0,24 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpHelper = void 0;
const https_1 = __importDefault(require("https"));
const http_1 = __importDefault(require("http"));
class HttpHelper {
// eslint-disable-next-line no-useless-constructor
import https from 'https';
import http from 'http';
export class HttpHelper {
constructor(str) {
this.str = str;
}
get(uri) {
return __awaiter(this, void 0, void 0, function* () {
// https://www.geeksforgeeks.org/node-js-https-request-function/
return new Promise((resolve, reject) => {
let data = '';
// https://www.geeksforgeeks.org/node-js-url-method/
// const _url = new url.URL(uri)
// const options = {
// hostname: _url.hostname,
// port: _url.protocol === 'https' ? 443 : 80,
// path: _url.pathname,
// method: 'GET'
// // https://levelup.gitconnected.com/how-to-resolve-certificate-errors-in-nodejs-app-involving-ssl-calls-781ce48daded
// // https://levelup.gitconnected.com/how-to-resolve-certificate-errors-in-nodejs-app-involving-ssl-calls-781ce48daded
// // NO FUNCIONO
// // rejectUnauthorized: false
// }
const protocol = new URL(uri).protocol;
const lib = protocol === 'https:' ? https_1.default : http_1.default;
const req = lib.request(uri, res => {
res.on('data', chunk => {
data = data + chunk.toString();
});
res.on('end', () => {
resolve(data);
});
async get(uri) {
return new Promise((resolve, reject) => {
let data = '';
const protocol = new URL(uri).protocol;
const lib = protocol === 'https:' ? https : http;
const req = lib.request(uri, res => {
res.on('data', chunk => {
data = data + chunk.toString();
});
req.on('error', error => {
reject(error);
res.on('end', () => {
resolve(data);
});
req.end();
});
req.on('error', error => {
reject(error);
});
req.end();
});

@@ -59,3 +28,2 @@ }

let url = source;
// https://splunktool.com/json-schema-validation-with-escaped-characters-in-patterns-fails
if (url.includes('~1')) {

@@ -67,6 +35,3 @@ url = this.str.replace(url, '~1', '/');

}
// https://www.geeksforgeeks.org/how-to-retain-special-characters-in-expressjs-router-url-request/
// https://codeforgeek.com/how-to-encode-decode-url-javascript/
if (url.includes('%')) {
// part = encodeURI(part)
url = decodeURI(url);

@@ -87,3 +52,2 @@ }

}
exports.HttpHelper = HttpHelper;
//# sourceMappingURL=http.js.map

@@ -9,1 +9,2 @@ export * from './utils';

export * from './array';
//# sourceMappingURL=index.d.ts.map

@@ -1,25 +0,9 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./utils"), exports);
__exportStar(require("./validator"), exports);
__exportStar(require("./fs"), exports);
__exportStar(require("./http"), exports);
__exportStar(require("./object"), exports);
__exportStar(require("./string"), exports);
__exportStar(require("./test"), exports);
__exportStar(require("./array"), exports);
export * from './utils';
export * from './validator';
export * from './fs';
export * from './http';
export * from './object';
export * from './string';
export * from './test';
export * from './array';
//# sourceMappingURL=index.js.map
import { Delta, DeltaOptions } from '../index';
import { IObjectHelper, IHttpHelper, IValidator, ObjectEqualOptions } from '../application';
import { IObjectHelper, IHttpHelper, IValidator, ObjectEqualOptions } from '../application/index';
export declare class ObjectHelper implements IObjectHelper {

@@ -30,1 +30,2 @@ private readonly http;

}
//# sourceMappingURL=object.d.ts.map

@@ -1,7 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectHelper = void 0;
const index_1 = require("../index");
class ObjectHelper {
// eslint-disable-next-line no-useless-constructor
import { Delta } from '../index';
export class ObjectHelper {
constructor(http, validator) {

@@ -66,11 +62,8 @@ this.http = http;

if (value === '.') {
// in case "".[0].name" where var is "."
return [value];
}
else if (value.startsWith('..')) {
// in case ".name.filter"
return ['.'].concat(value.substring(2).split('.'));
}
else if (value.startsWith('.')) {
// in case ".name.filter"
return ['.'].concat(value.substring(1).split('.'));

@@ -87,3 +80,2 @@ }

if (Array.isArray(value)) {
// Example: orders.0.number
if (this.validator.isPositiveInteger(name)) {

@@ -122,6 +114,4 @@ const index = parseInt(name);

const name = names[i];
// if is an array and name is a positive integer
if (Array.isArray(data) && this.validator.isPositiveInteger(name)) {
const index = Number(name);
// If the index exceeds the length of the array, nothing assigns it.
if (index >= data.length) {

@@ -300,3 +290,3 @@ return false;

_delta(path, current, old, options) {
const delta = new index_1.Delta();
const delta = new Delta();
if (current === undefined || current === null) {

@@ -393,3 +383,3 @@ throw new Error('current value can\'t empty');

if (current && Array.isArray(current) && (!old || !Array.isArray(old))) {
const arrayDelta = new index_1.Delta();
const arrayDelta = new Delta();
arrayDelta.new = current.map((p, i) => ({ name: i.toString(), new: p }));

@@ -401,3 +391,3 @@ if (delta.children === undefined)

else if (old && Array.isArray(old) && (!current || !Array.isArray(current))) {
const arrayDelta = new index_1.Delta();
const arrayDelta = new Delta();
arrayDelta.remove = old.map((p, i) => ({ name: i.toString(), old: p }));

@@ -414,3 +404,3 @@ if (delta.children === undefined)

else if (current.length > 0 && typeof current[0] !== 'object') {
const arrayDelta = new index_1.Delta();
const arrayDelta = new Delta();
const news = current.filter((p) => old.indexOf(p) === -1);

@@ -455,3 +445,3 @@ const unchanged = current.filter((p) => old.indexOf(p) !== -1);

}
const arrayDelta = new index_1.Delta();
const arrayDelta = new Delta();
for (const item of current) {

@@ -506,3 +496,2 @@ const oldItem = old.find((p) => p[key] === item[key]);

}
exports.ObjectHelper = ObjectHelper;
//# sourceMappingURL=object.js.map
import { NormalizeOptions } from '../domain/base';
import { EqualOptions, IStringHelper, IValidator } from '../application';
import { EqualOptions, IStringHelper, IValidator } from '../application/index';
export declare class StringHelper implements IStringHelper {

@@ -17,7 +17,2 @@ private readonly validator;

notation(source: string, type?: 'camel' | 'pascal'): string;
/**
* Normalize a string with utf-8 characters.
* @param source string to normalize
* @returns returns a lowercase string replacing extraneous characters with ascii characters between 97 to 121 or numbers
*/
normalize(source: string, options?: NormalizeOptions): string;

@@ -28,20 +23,5 @@ private _plural;

private _irregular;
/**
* Returns the plural of an English word.
*
* @export
* @param {string} word
* @param {number} [amount]
* @returns {string}
*/
plural(word: string, amount?: number): string;
/**
* Returns the singular of an English word.
*
* @export
* @param {string} word
* @param {number} [amount]
* @returns {string}
*/
singular(word: string, amount?: number): string;
}
//# sourceMappingURL=string.d.ts.map

@@ -1,6 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StringHelper = void 0;
class StringHelper {
// eslint-disable-next-line no-useless-constructor
export class StringHelper {
constructor(validator) {

@@ -171,3 +167,2 @@ this.validator = validator;

if (['_', '.', '-', ' '].includes(char)) {
// It is in the case that the text begins with a special character
if (result.length > 0) {

@@ -194,7 +189,2 @@ nextUpper = true;

}
/**
* Normalize a string with utf-8 characters.
* @param source string to normalize
* @returns returns a lowercase string replacing extraneous characters with ascii characters between 97 to 121 or numbers
*/
normalize(source, options = {}) {

@@ -205,3 +195,2 @@ if (source === null || source === undefined) {

const result = [];
// https://stackoverflow.com/questions/4547609/how-to-get-character-array-from-a-string
const buffer = Array.from(source);

@@ -212,3 +201,2 @@ const length = buffer.length;

if (ascii > 47 && ascii < 58) {
// numbers
result.push(String.fromCharCode(ascii));

@@ -218,3 +206,2 @@ }

if (options.toUpper) {
// convert lowercase to uppercase
result.push(String.fromCharCode(ascii - 32));

@@ -228,3 +215,2 @@ }

if (options.toLower) {
// convert uppercase to lowercase
result.push(String.fromCharCode(ascii + 32));

@@ -237,219 +223,164 @@ }

else if (ascii < 48 || (ascii > 90 && ascii < 97) || (ascii > 122 && ascii < 128)) {
// excluded characters
continue;
}
else if ([216, 248, 7443].includes(ascii)) {
// Ø ø ᴓ
result.push('0');
}
else if ([604, 605, 8488, 42923].includes(ascii)) {
// ɜ ɝ ℨ Ɜ
result.push('3');
}
else if ([224, 225, 226, 227, 228, 229, 257, 259, 261, 395, 396, 462, 513, 515, 551, 593, 592, 7681, 867, 7841, 7843, 11365].includes(ascii)) {
// à á â ã ä å ā ă ą Ƌ ƌ ǎ ȁ ȃ ȧ ɑ ɐ ḁ ͣ ạ ả ⱥ
result.push(options.toUpper ? 'A' : 'a');
}
else if ([384, 385, 386, 387, 7683, 7687, 8468, 7685, 595].includes(ascii)) {
// ƀ Ɓ Ƃ ƃ ḃ ḇ ℔ ḅ ɓ
result.push(options.toUpper ? 'B' : 'b');
}
else if ([231, 263, 265, 269, 392, 596, 597, 267, 872, 8580].includes(ascii)) {
// ç ć ĉ č ƈ ɔ ɕ ċ ͨ ↄ
result.push(options.toUpper ? 'C' : 'c');
}
else if ([271, 545, 598, 599, 273, 873, 7691, 7693, 7695, 7697, 7699, 8518].includes(ascii)) {
// ď ȡ ɖ ɗ đ ͩ ḋ ḍ ḏ ḑ ḓ ⅆ
result.push(options.toUpper ? 'D' : 'd');
}
else if ([232, 233, 234, 235, 275, 277, 279, 281, 283, 339, 477, 517, 519, 553, 571, 572, 583, 600, 868, 7705, 7707, 7865, 7867, 7869, 8493, 8495, 8519].includes(ascii)) {
// è é ê ë ē ĕ ė ę ě œ ǝ ȅ ȇ ȩ Ȼ ȼ ɇ ɘ ͤ ḙ ḛ ẹ ẻ ẽ ℭ ℯ ⅇ
result.push(options.toUpper ? 'E' : 'e');
}
else if ([402, 589, 619, 620, 607, 7711, 7835].includes(ascii)) {
// ƒ ɍ ɫ ɬ ɟ ḟ ẛ
result.push(options.toUpper ? 'F' : 'f');
}
else if ([285, 287, 289, 291, 485, 487, 501, 608, 609, 7713, 8458, 42924].includes(ascii)) {
// ĝ ğ ġ ģ ǥ ǧ ǵ ɠ ɡ ḡ ℊ Ɡ
result.push(options.toUpper ? 'G' : 'g');
}
else if ([293, 295, 543, 614, 686, 688, 874, 7715, 7717, 7721, 8341, 7723, 42893, 7719].includes(ascii)) {
// ĥ ħ ȟ ɦ ʮ ʰ ͪ ḣ ḥ ḩ ₕ ḫ Ɥ ḧ
result.push(options.toUpper ? 'H' : 'h');
}
else if ([297, 299, 301, 303, 464, 521, 523, 236, 237, 238, 239, 616, 7522, 869, 7725, 7433, 8305, 8520, 7883].includes(ascii)) {
// ĩ ī ĭ į ǐ ȉ ȋ ì í î ï ɨ ᵢ ͥ ḭ ᴉ ⁱ ⅈ ị
result.push(options.toUpper ? 'I' : 'i');
}
else if ([585, 669, 690, 8464, 8521].includes(ascii)) {
// ɉ ʝ ʲ ℐ ⅉ
result.push(options.toUpper ? 'J' : 'j');
}
else if ([409, 489, 670, 7729, 7733, 8342].includes(ascii)) {
// ƙ ǩ ʞ ḱ ḵ ₖ
result.push(options.toUpper ? 'K' : 'k');
}
else if ([314, 316, 318, 320, 322, 410, 564, 621, 737, 8343, 7735, 7741, 8466, 8467, 7739].includes(ascii)) {
// ĺ ļ ľ ŀ ł ƚ ȴ ɭ ˡ ₗ ḷ ḽ ℒ ℓ ḻ
result.push(options.toUpper ? 'L' : 'l');
}
else if ([623, 624, 625, 7455, 875, 7743, 7745, 7747, 8344].includes(ascii)) {
// ɯ ɰ ɱ ᴟ ͫ ḿ ṁ ṃ ₘ
result.push(options.toUpper ? 'M' : 'm');
}
else if ([241, 324, 326, 328, 414, 505, 626, 627, 565, 7749, 7751, 7753, 7755, 8345].includes(ascii)) {
// ñ ń ņ ň ƞ ǹ ɲ ɳ ȵ ṅ ṇ ṉ ṋ ₙ
result.push(options.toUpper ? 'N' : 'n');
}
else if ([242, 243, 244, 245, 246, 333, 335, 337, 417, 466, 525, 527, 7439, 7441, 870, 7885, 8500, 559, 629, 7887].includes(ascii)) {
// ò ó ô õ ö ō ŏ ő ơ ǒ ȍ ȏ ᴏ ᴑ ͦ ọ ℴ ȯ ɵ ỏ
result.push(options.toUpper ? 'O' : 'o');
}
else if ([421, 7448, 7765, 7767, 8346, 8472].includes(ascii)) {
// ƥ ᴘ ṕ ṗ ₚ ℘
result.push(options.toUpper ? 'P' : 'p');
}
else if ([586, 587, 672].includes(ascii)) {
// Ɋ ɋ ʠ
result.push(options.toUpper ? 'Q' : 'q');
}
else if ([341, 343, 345, 529, 531, 633, 634, 635, 636, 637, 638, 639, 7523, 691, 692, 876, 7769, 7771, 7775].includes(ascii)) {
// ŕ ŗ ř ȑ ȓ ɹ ɺ ɻ ɼ ɽ ɾ ɿ ᵣ ʳ ʴ ͬ ṙ ṛ ṟ
result.push(options.toUpper ? 'R' : 'r');
}
else if ([347, 349, 351, 353, 537, 575, 642, 738, 7777, 7779, 8347].includes(ascii)) {
// ś ŝ ş š ș ȿ ʂ ˢ ṡ ṣ ₛ
result.push(options.toUpper ? 'S' : 's');
}
else if ([355, 357, 359, 427, 429, 429, 573, 566, 647, 648, 7451, 877, 7787, 7789, 7791, 7793, 8348, 11366].includes(ascii)) {
// ţ ť ŧ ƫ ƭ ƭ Ƚ ȶ ʇ ʈ ᴛ ͭ ṫ ṭ ṯ ṱ ₜ ⱦ
result.push(options.toUpper ? 'T' : 't');
}
else if ([249, 250, 251, 252, 361, 363, 365, 367, 369, 432, 434, 468, 533, 535, 651, 7452, 7453, 7454, 7524, 871, 7795, 7797, 7799, 7909, 7911].includes(ascii)) {
// ù ú û ü ũ ū ŭ ů ű ư Ʋ ǔ ȕ ȗ ʋ ᴜ ᴝ ᴞ ᵤ ͧ ṳ ṵ ṷ ụ ủ
result.push(options.toUpper ? 'U' : 'u');
}
else if ([7456, 7525, 878, 652, 7807].includes(ascii)) {
// ᴠ ᵥ ͮ ʌ ṿ
result.push(options.toUpper ? 'V' : 'v');
}
else if ([373, 653, 7457, 695].includes(ascii)) {
// ŵ ʍ ᴡ ʷ
result.push(options.toUpper ? 'W' : 'w');
}
else if ([739, 879, 7819, 7821, 10005, 10006, 10007, 10008].includes(ascii)) {
// ˣ ͯ ẋ ẍ ✕ ✖ ✗ ✘ x
result.push(options.toUpper ? 'X' : 'x');
}
else if ([253, 255, 371, 375, 563, 435, 436, 591, 613, 654, 655, 696, 7823, 7923, 7925, 7927, 7929].includes(ascii)) {
// ý ÿ ų ŷ ȳ Ƴ ƴ ɏ ɥ ʎ ʏ ʸ ẏ ỳ ỵ ỷ ỹ
result.push(options.toUpper ? 'Y' : 'y');
}
else if ([378, 380, 382, 438, 549, 656, 657, 576, 7458, 7825, 7827, 7829].includes(ascii)) {
// ź ż ž ƶ ȥ ʐ ʑ ɀ ᴢ ẑ ẓ ẕ
result.push(options.toUpper ? 'Z' : 'z');
}
else if ([192, 193, 194, 195, 196, 197, 256, 258, 260, 461, 512, 514, 550, 570, 580, 649, 7424, 7680, 7840, 7842, 11373, 11375].includes(ascii)) {
// À Á Â Ã Ä Å Ā Ă Ą Ǎ Ȁ Ȃ Ȧ Ⱥ Ʉ ʉ ᴀ Ḁ Ạ Ả Ɑ Ɐ
result.push(options.toLower ? 'a' : 'A');
}
else if ([579, 606, 665, 7427, 7682, 7684, 7686, 8492].includes(ascii)) {
// Ƀ ɞ ʙ ᴃ Ḃ Ḅ Ḇ ℬ
result.push(options.toLower ? 'b' : 'B');
}
else if ([199, 262, 264, 266, 268, 390, 391, 663, 7428, 7440, 7442, 8450, 8579].includes(ascii)) {
// Ç Ć Ĉ Ċ Č Ɔ Ƈ ʗ ᴄ ᴐ ᴒ ℂ Ↄ
result.push(options.toLower ? 'c' : 'C');
}
else if ([270, 272, 393, 394, 7429, 7690, 7692, 7694, 7696, 7698, 8517].includes(ascii)) {
// Ď Đ Ɖ Ɗ ᴅ Ḋ Ḍ Ḏ Ḑ Ḓ ⅅ
result.push(options.toLower ? 'd' : 'D');
}
else if ([200, 201, 202, 203, 274, 276, 278, 280, 282, 338, 398, 400, 516, 518, 552, 582, 603, 7431, 7432, 7704, 7706, 7864, 7866, 7868, 8496, 8959].includes(ascii)) {
// È É Ê Ë Ē Ĕ Ė Ę Ě Œ Ǝ Ɛ Ȅ Ȇ Ȩ Ɇ ɛ ᴇ ᴈ Ḙ Ḛ Ẹ Ẻ Ẽ ℰ ⋿
result.push(options.toLower ? 'e' : 'E');
}
else if ([401, 7710, 8497, 8498, 8526].includes(ascii)) {
// Ƒ Ḟ ℱ Ⅎ ⅎ
result.push(options.toLower ? 'f' : 'F');
}
else if ([284, 286, 288, 290, 403, 484, 486, 500, 610, 666, 667, 7712, 8513].includes(ascii)) {
// Ĝ Ğ Ġ Ģ Ɠ Ǥ Ǧ Ǵ ɢ ʚ ʛ Ḡ ⅁
result.push(options.toLower ? 'g' : 'G');
}
else if ([292, 294, 542, 668, 7714, 7716, 7718, 7720, 7722, 8459, 8460, 8461, 42922].includes(ascii)) {
// Ĥ Ħ Ȟ ʜ Ḣ Ḥ Ḧ Ḩ Ḫ ℋ ℌ ℍ Ɦ
result.push(options.toLower ? 'h' : 'H');
}
else if ([296, 298, 300, 302, 304, 407, 463, 520, 522, 204, 205, 206, 207, 618, 7724, 7880, 7881, 7882].includes(ascii)) {
// Ĩ Ī Ĭ Į İ Ɨ Ǐ Ȉ Ȋ Ì Í Î Ï ɪ Ḭ Ỉ ỉ Ị
result.push(options.toLower ? 'i' : 'I');
}
else if ([308, 309, 584, 567, 7434, 8465].includes(ascii)) {
// Ĵ ĵ Ɉ ȷ ᴊ ℑ
result.push(options.toLower ? 'j' : 'J');
}
else if ([408, 488, 7435, 7728, 7730, 7731, 7732, 42928].includes(ascii)) {
// Ƙ Ǩ ᴋ Ḱ Ḳ ḳ Ḵ Ʞ
result.push(options.toLower ? 'k' : 'K');
}
else if ([313, 315, 317, 319, 321, 671, 7436, 7734, 7738, 7740, 8514, 8515, 11362, 42925].includes(ascii)) {
// Ĺ Ļ Ľ Ŀ Ł ʟ ᴌ Ḷ Ḻ Ḽ ⅂ ⅃ Ɫ Ɬ
result.push(options.toLower ? 'l' : 'L');
}
else if ([7437, 7742, 7744, 7746, 8499, 11374].includes(ascii)) {
// ᴍ Ḿ Ṁ Ṃ ℳ Ɱ
result.push(options.toLower ? 'm' : 'M');
}
else if ([209, 323, 325, 327, 413, 504, 544, 628, 7438, 7748, 7750, 7752, 7754, 8469].includes(ascii)) {
// Ñ Ń Ņ Ň Ɲ Ǹ Ƞ ɴ ᴎ Ṅ Ṇ Ṉ Ṋ ℕ
result.push(options.toLower ? 'n' : 'N');
}
else if ([210, 211, 212, 213, 214, 332, 334, 336, 415, 416, 465, 524, 526, 558, 7884, 7886].includes(ascii)) {
// Ò Ó Ô Õ Ö Ō Ŏ Ő Ɵ Ơ Ǒ Ȍ Ȏ Ȯ Ọ Ỏ
result.push(options.toLower ? 'o' : 'O');
}
else if ([420, 7764, 7766, 8473].includes(ascii)) {
// Ƥ Ṕ Ṗ ℙ
result.push(options.toLower ? 'p' : 'P');
}
else if ([490, 491, 8474, 8506].includes(ascii)) {
// Ǫ ǫ ℚ ℺
result.push(options.toLower ? 'q' : 'Q');
}
else if ([340, 342, 344, 422, 528, 530, 640, 641, 588, 7449, 7450, 694, 7768, 7770, 7774, 8475, 8476, 8477, 11364].includes(ascii)) {
// Ŕ Ŗ Ř Ʀ Ȑ Ȓ ʀ ʁ Ɍ ᴙ ᴚ ʶ Ṙ Ṛ Ṟ ℛ ℜ ℝ Ɽ
result.push(options.toLower ? 'r' : 'R');
}
else if ([346, 348, 350, 352, 536, 7776, 7778, 11390].includes(ascii)) {
// Ś Ŝ Ş Š Ș Ṡ Ṣ Ȿ
result.push(options.toLower ? 's' : 'S');
}
else if ([354, 356, 358, 428, 430, 538, 574, 7786, 7788, 7790, 7792, 42929].includes(ascii)) {
// Ţ Ť Ŧ Ƭ Ʈ Ț Ⱦ Ṫ Ṭ Ṯ Ṱ Ʇ
result.push(options.toLower ? 't' : 'T');
}
else if ([217, 218, 219, 220, 360, 362, 364, 366, 368, 431, 467, 532, 534, 7794, 7796, 7798, 7908, 7910].includes(ascii)) {
// Ù Ú Û Ü Ũ Ū Ŭ Ů Ű Ư Ǔ Ȕ Ȗ Ṳ Ṵ Ṷ Ụ Ủ
result.push(options.toLower ? 'u' : 'U');
}
else if ([7804, 7805, 7806].includes(ascii)) {
// Ṽ ṽ Ṿ
result.push(options.toLower ? 'v' : 'V');
}
else if ([412, 372, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817].includes(ascii)) {
// Ɯ Ŵ Ẁ ẁ Ẃ ẃ Ẅ ẅ Ẇ ẇ Ẉ ẉ
result.push(options.toLower ? 'w' : 'W');
}
else if ([7818, 7820].includes(ascii)) {
// Ẋ Ẍ
result.push(options.toLower ? 'x' : 'X');
}
else if ([221, 370, 374, 376, 562, 590, 7822, 7922, 7924, 7926, 7928, 8516].includes(ascii)) {
// Ý Ų Ŷ Ÿ Ȳ Ɏ Ẏ Ỳ Ỵ Ỷ Ỹ ⅄
result.push(options.toLower ? 'y' : 'Y');
}
else if ([377, 379, 381, 437, 548, 7824, 7826, 7828, 8484, 11391].includes(ascii)) {
// Ź Ż Ž Ƶ Ȥ Ẑ Ẓ Ẕ ℤ Ɀ
result.push(options.toLower ? 'z' : 'Z');

@@ -460,11 +391,2 @@ }

}
// https://stackoverflow.com/questions/27194359/javascript-pluralize-an-english-string
/**
* Returns the plural of an English word.
*
* @export
* @param {string} word
* @param {number} [amount]
* @returns {string}
*/
plural(word, amount) {

@@ -474,7 +396,5 @@ if (amount !== undefined && amount === 1) {

}
// save some time in the case that singular and plural are the same
if (this._uncountable.indexOf(word.toLowerCase()) >= 0) {
return word;
}
// check for irregular forms
for (const w in this._irregular) {

@@ -487,3 +407,2 @@ const pattern = new RegExp(`${w}$`, 'i');

}
// check for matches using regular expressions
for (const reg in this._plural) {

@@ -497,10 +416,2 @@ const pattern = new RegExp(reg, 'i');

}
/**
* Returns the singular of an English word.
*
* @export
* @param {string} word
* @param {number} [amount]
* @returns {string}
*/
singular(word, amount) {

@@ -510,7 +421,5 @@ if (amount !== undefined && amount !== 1) {

}
// save some time in the case that singular and plural are the same
if (this._uncountable.indexOf(word.toLowerCase()) >= 0) {
return word;
}
// check for irregular forms
for (const w in this._irregular) {

@@ -523,3 +432,2 @@ const pattern = new RegExp(`${this._irregular[w]}$`, 'i');

}
// check for matches using regular expressions
for (const reg in this._singular) {

@@ -534,3 +442,2 @@ const pattern = new RegExp(reg, 'i');

}
exports.StringHelper = StringHelper;
//# sourceMappingURL=string.js.map

@@ -1,3 +0,3 @@

import { IBuildTest, TestBuildInfo } from '../domain';
import { ITestHelper, IStringHelper, IObjectHelper, IFsHelper, IUtils, ITestSuiteBuilder, ITestBuilder } from '../application';
import { IBuildTest, TestBuildInfo } from '../domain/index';
import { ITestHelper, IStringHelper, IObjectHelper, IFsHelper, IUtils, ITestSuiteBuilder, ITestBuilder } from '../application/index';
export declare class TestSuiteBuilder implements ITestSuiteBuilder {

@@ -32,1 +32,2 @@ private readonly utils;

}
//# sourceMappingURL=test.d.ts.map

@@ -1,15 +0,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestHelper = exports.TestBuilder = exports.TestSuiteBuilder = void 0;
class TestSuiteBuilder {
// eslint-disable-next-line no-useless-constructor
export class TestSuiteBuilder {
constructor(utils, fs, obj) {

@@ -25,51 +12,45 @@ this.utils = utils;

}
build(path) {
return __awaiter(this, void 0, void 0, function* () {
for (const test of this.tests) {
const suite = yield this.buildSuite(test.build());
yield this.fs.write(`${path}/${suite.name}.json`, JSON.stringify(suite, null, 2));
}
});
async build(path) {
for (const test of this.tests) {
const suite = await this.buildSuite(test.build());
await this.fs.write(`${path}/${suite.name}.json`, JSON.stringify(suite, null, 2));
}
}
buildSuite(request) {
return __awaiter(this, void 0, void 0, function* () {
const suite = {
name: request.name,
context: this.obj.clone(request.context),
cases: [],
errors: 0
};
for (const _caseRequest of request.cases) {
const _case = { name: _caseRequest.name, tests: [], errors: 0 };
let errors = 0;
for (const test of _caseRequest.tests) {
try {
if (this.utils.isAsync(_caseRequest.func)) {
const result = yield _caseRequest.func(test, request.context);
_case.tests.push({ test, result });
}
else {
const result = _caseRequest.func(test, request.context);
_case.tests.push({ test, result });
}
async buildSuite(request) {
const suite = {
name: request.name,
context: this.obj.clone(request.context),
cases: [],
errors: 0
};
for (const _caseRequest of request.cases) {
const _case = { name: _caseRequest.name, tests: [], errors: 0 };
let errors = 0;
for (const test of _caseRequest.tests) {
try {
if (this.utils.isAsync(_caseRequest.func)) {
const result = await _caseRequest.func(test, request.context);
_case.tests.push({ test, result });
}
catch (error) {
errors++;
_case.tests.push({ test, error: error.toString(), stack: error.stack.toString() });
else {
const result = _caseRequest.func(test, request.context);
_case.tests.push({ test, result });
}
}
_case.errors = errors;
suite.cases.push(_case);
catch (error) {
errors++;
_case.tests.push({ test, error: error.toString(), stack: error.stack.toString() });
}
}
suite.errors = suite.cases.reduce((errors, p) => p.errors + errors, 0);
if (suite.errors > 0) {
console.error(`${suite.name} ${suite.errors} errors`);
}
return suite;
});
_case.errors = errors;
suite.cases.push(_case);
}
suite.errors = suite.cases.reduce((errors, p) => p.errors + errors, 0);
if (suite.errors > 0) {
console.error(`${suite.name} ${suite.errors} errors`);
}
return suite;
}
}
exports.TestSuiteBuilder = TestSuiteBuilder;
class TestBuilder {
// eslint-disable-next-line no-useless-constructor
export class TestBuilder {
constructor(utils, fs, str) {

@@ -85,19 +66,17 @@ this.utils = utils;

}
build(path) {
return __awaiter(this, void 0, void 0, function* () {
for (const test of this.tests) {
if (test.suite === undefined && test.source !== undefined) {
const content = yield this.fs.read(test.source);
if (content === undefined || content === null) {
throw new Error(`${test.source} not found`);
}
test.suite = JSON.parse(content);
async build(path) {
for (const test of this.tests) {
if (test.suite === undefined && test.source !== undefined) {
const content = await this.fs.read(test.source);
if (content === undefined || content === null) {
throw new Error(`${test.source} not found`);
}
if (test.suite === undefined) {
throw new Error('Test suite undefined');
}
const content = this.buildSuite(test.suite, test.template);
yield this.fs.write(`${path}/${test.suite.name}.test.ts`, content);
test.suite = JSON.parse(content);
}
});
if (test.suite === undefined) {
throw new Error('Test suite undefined');
}
const content = this.buildSuite(test.suite, test.template);
await this.fs.write(`${path}/${test.suite.name}.test.ts`, content);
}
}

@@ -129,3 +108,2 @@ buildSuite(suite, template) {

result,
// eslint-disable-next-line quotes
test: test.test.includes('\n')

@@ -137,10 +115,6 @@ ? '`' + test.test + '`'

}
const caseText = this.utils.template(
// eslint-disable-next-line no-template-curly-in-string
'\ttest(\'${name}\', () => {\n${tests}\t})\n', { name: _case.name, tests: tests.join('') });
const caseText = this.utils.template('\ttest(\'${name}\', () => {\n${tests}\t})\n', { name: _case.name, tests: tests.join('') });
cases.push(caseText);
}
const suiteText = this.utils.template(
// eslint-disable-next-line no-template-curly-in-string
'describe(\'${name}\', () => {\n\tconst context = JSON.parse(\'${context}\')\n${cases}})\n', {
const suiteText = this.utils.template('describe(\'${name}\', () => {\n\tconst context = JSON.parse(\'${context}\')\n${cases}})\n', {
name: suite.name,

@@ -153,5 +127,3 @@ context: suite.context !== undefined ? JSON.stringify(suite.context) : '{}',

}
exports.TestBuilder = TestBuilder;
class TestHelper {
// eslint-disable-next-line no-useless-constructor
export class TestHelper {
constructor(utils, fs, str, obj) {

@@ -170,3 +142,2 @@ this.utils = utils;

}
exports.TestHelper = TestHelper;
//# sourceMappingURL=test.js.map

@@ -1,3 +0,3 @@

import { IReplacer } from '../domain';
import { ContextReplacer, EnvironmentVariableReplacer, IUtils, IValidator, IObjectHelper } from '../application';
import { IReplacer } from '../domain/index';
import { ContextReplacer, EnvironmentVariableReplacer, IUtils, IValidator, IObjectHelper } from '../application/index';
export declare class Utils implements IUtils {

@@ -11,8 +11,2 @@ private readonly validator;

toNumber(value: any): number;
/**
* Random integer between 2 numbers
* @param min
* @param max
* @returns
*/
randomInteger(min: number, max: number): number;

@@ -34,1 +28,2 @@ nvl(value: any, _default: any): any;

}
//# sourceMappingURL=utils.d.ts.map

@@ -1,17 +0,4 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Utils = void 0;
const child_process_1 = require("child_process");
const application_1 = require("../application");
class Utils {
// eslint-disable-next-line no-useless-constructor
import { exec } from 'child_process';
import { ContextReplacer, EnvironmentVariableReplacer } from '../application/index';
export class Utils {
constructor(validator, obj) {

@@ -25,3 +12,2 @@ this.validator = validator;

if (typeof value === 'string') {
// TODO determinar si es fecha.
return 'string';

@@ -34,14 +20,12 @@ }

}
exec(cmd_1) {
return __awaiter(this, arguments, void 0, function* (cmd, cwd = process.cwd()) {
return new Promise((resolve, reject) => {
(0, child_process_1.exec)(this.escapeShell(cmd), { cwd }, (error, stdout, stderr) => {
if (stdout)
return resolve(stdout);
if (stderr)
return resolve(stderr);
if (error)
return reject(error);
return resolve('');
});
async exec(cmd, cwd = process.cwd()) {
return new Promise((resolve, reject) => {
exec(this.escapeShell(cmd), { cwd }, (error, stdout, stderr) => {
if (stdout)
return resolve(stdout);
if (stderr)
return resolve(stderr);
if (error)
return reject(error);
return resolve('');
});

@@ -53,8 +37,2 @@ });

}
/**
* Random integer between 2 numbers
* @param min
* @param max
* @returns
*/
randomInteger(min, max) {

@@ -77,7 +55,5 @@ return Math.floor(Math.random() * (max - min)) + min;

}
sleep() {
return __awaiter(this, arguments, void 0, function* (ms = 1000) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
async sleep(ms = 1000) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});

@@ -96,15 +72,7 @@ }

}
// eslint-disable-next-line @typescript-eslint/ban-types
isAsync(func) {
// info: https://stackoverflow.com/questions/38508420/how-to-know-if-a-function-is-async
const string = func.toString().trim();
return !!(
// native
string.match(/^async /) ||
return !!(string.match(/^async /) ||
string.match(/__awaiter/) ||
// babel (this may change, but hey...)
string.match(/return _ref[^\\.]*\.apply/)
// insert your other dirty transpiler check
// there are other more complex situations that maybe require you to check the return line for a *promise*
);
string.match(/return _ref[^\\.]*\.apply/));
}

@@ -115,6 +83,6 @@ solveEnvironmentVars(source) {

createEnvironmentVariableReplacer() {
return new application_1.EnvironmentVariableReplacer();
return new EnvironmentVariableReplacer();
}
createContextReplacer() {
return new application_1.ContextReplacer(this.obj);
return new ContextReplacer(this.obj);
}

@@ -198,3 +166,2 @@ template(template, replacer, parse = false) {

buffer[index + 1] === '{') {
// Example: ${XXX}
isVar = true;

@@ -207,3 +174,2 @@ close = '}';

buffer[index + 1] !== ' ') {
// Example: $XXX
isVar = true;

@@ -218,3 +184,2 @@ close = ' ';

if (close === '}') {
// Example: 'words ${XXXX'
result.push('${');

@@ -224,3 +189,2 @@ result.push(...chars.join(''));

else {
// Example: 'words $XXXX'
const value = this.replace(chars.join(''), close, replacer);

@@ -250,3 +214,2 @@ result.push(value);

}
exports.Utils = Utils;
//# sourceMappingURL=utils.js.map

@@ -1,2 +0,2 @@

import { IValidator } from '../application';
import { IValidator } from '../application/index';
export declare class Validator implements IValidator {

@@ -37,1 +37,2 @@ private get reAlphanumeric();

}
//# sourceMappingURL=validator.d.ts.map

@@ -1,12 +0,2 @@

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Validator = void 0;
const domain_1 = require("../domain");
let Validator = class Validator {
export class Validator {
get reAlphanumeric() { return /[a-zA-Z0-9_.]+$/; }

@@ -18,3 +8,2 @@ get reInt() { return /^[0-9]+$/; }

get reDateTime() { return /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/; }
// https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime
get reTime() { return /\[0-2]\d:[0-5]\d:[0-5]\d/; }

@@ -162,7 +151,3 @@ isObject(obj) {

}
};
exports.Validator = Validator;
exports.Validator = Validator = __decorate([
(0, domain_1.Service)('h3lp.val')
], Validator);
}
//# sourceMappingURL=validator.js.map
{
"name": "h3lp",
"version": "1.12.1",
"description": "Helper for nodeJs",
"author": "Flavio Lionel Rita <flaviolrita@hotmail.com>",
"license": "Apache-2.0 License",
"engines": {
"node": ">=10"
},
"main": "index.js",
"homepage": "https://github.com/data7expressions/h3lp#readme",
"bugs": {
"url": "https://github.com/data7expressions/h3lp/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/data7expressions/h3lp.git"
"url": "https://github.com/data7expressions/data7expressions.git"
},
"standard-version": {
"header": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\n## Versions\n"
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "grunt test"
"dependencies": {
"undici-types": "^6.19.2"
},

@@ -33,3 +26,4 @@ "keywords": [

],
"types": "index.d.ts"
"types": "index.d.ts",
"version": "2.0.0"
}
export {};
//# sourceMappingURL=object.test.d.ts.map

@@ -1,17 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable object-curly-spacing */
/* eslint-disable comma-spacing */
/* eslint-disable key-spacing */
/* eslint-disable quote-props */
const __1 = require("../../");
import { h3lp } from '../../index';
describe('object', () => {
const context = JSON.parse('{"orders":[{"number":"20001","customer":{"firstName":"John","lastName":"Murphy"},"orderTime":"2022-07-30T10:15:54","details":[{"article":"Pear","unitPrice":1.78,"qty":2},{"article":"Banana","unitPrice":1.99,"qty":1},{"article":"White grape","unitPrice":2.03,"qty":1}]},{"number":"20002","customer":{"firstName":"Paul","lastName":"Smith"},"orderTime":"2022-07-30T12:12:43","details":[{"article":"Apple","unitPrice":2.15,"qty":1},{"article":"Banana","unitPrice":1.99,"qty":2},{"article":"Pear","unitPrice":1.78,"qty":1}]}]}');
test('access', () => {
expect(__1.h3lp.obj.getValue(context, 'orders.number')).toStrictEqual(['20001', '20002']);
expect(__1.h3lp.obj.getValue(context, 'orders.0.number')).toStrictEqual('20001');
expect(__1.h3lp.obj.getValue(context, 'orders.1.customer.firstName')).toStrictEqual('Paul');
expect(__1.h3lp.obj.getValue(context, 'orders.customer.firstName')).toStrictEqual(['John', 'Paul']);
expect(__1.h3lp.obj.getValue(context, 'orders.0.details.article')).toStrictEqual(['Pear', 'Banana', 'White grape']);
expect(__1.h3lp.obj.getValue(context, 'orders.0.details')).toStrictEqual([{ 'article': 'Pear', 'unitPrice': 1.78, 'qty': 2 }, { 'article': 'Banana', 'unitPrice': 1.99, 'qty': 1 }, { 'article': 'White grape', 'unitPrice': 2.03, 'qty': 1 }]);
expect(h3lp.obj.getValue(context, 'orders.number')).toStrictEqual(['20001', '20002']);
expect(h3lp.obj.getValue(context, 'orders.0.number')).toStrictEqual('20001');
expect(h3lp.obj.getValue(context, 'orders.1.customer.firstName')).toStrictEqual('Paul');
expect(h3lp.obj.getValue(context, 'orders.customer.firstName')).toStrictEqual(['John', 'Paul']);
expect(h3lp.obj.getValue(context, 'orders.0.details.article')).toStrictEqual(['Pear', 'Banana', 'White grape']);
expect(h3lp.obj.getValue(context, 'orders.0.details')).toStrictEqual([{ 'article': 'Pear', 'unitPrice': 1.78, 'qty': 2 }, { 'article': 'Banana', 'unitPrice': 1.99, 'qty': 1 }, { 'article': 'White grape', 'unitPrice': 2.03, 'qty': 1 }]);
});

@@ -22,3 +16,3 @@ test('delta simple object', () => {

const expected = '{"unchanged":[{"name":"a","value":1}],"changed":[{"name":"b","new":"test","old":"Test"}]}';
const delta = __1.h3lp.obj.delta(a, b);
const delta = h3lp.obj.delta(a, b);
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -30,3 +24,3 @@ });

const expected = '{"unchanged":[{"name":"a","value":1}],"children":[{"name":"b","type":"array","change":true,"delta":{"new":[{"name":"2","new":3}],"remove":[{"name":"2","old":4}],"unchanged":[{"name":"0","value":1},{"name":"1","value":2}]}}]}';
const delta = __1.h3lp.obj.delta(a, b);
const delta = h3lp.obj.delta(a, b);
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -38,3 +32,3 @@ });

const expected = '{"unchanged":[{"name":"a","value":1}],"changed":[{"name":"b","new":{"code":"ARG","name":"Argentina"},"old":{"code":"ARG","name":"argentina"},"delta":{"unchanged":[{"name":"code","value":"ARG"}],"changed":[{"name":"name","new":"Argentina","old":"argentina"}]}}]}';
const delta = __1.h3lp.obj.delta(a, b);
const delta = h3lp.obj.delta(a, b);
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -46,3 +40,3 @@ });

const expected = '{"unchanged":[{"name":"a","value":1}],"children":[{"name":"b","type":"array","change":true,"delta":{"unchanged":[{"name":"b","value":{"code":"ARG","name":"Argentina"}}],"changed":[{"name":"b","new":{"code":"BR","name":"Brasil"},"old":{"code":"BR","name":"Brazil"},"delta":{"unchanged":[{"name":"code","value":"BR"}],"changed":[{"name":"name","new":"Brasil","old":"Brazil"}]}}]}}]}';
const delta = __1.h3lp.obj.delta(a, b);
const delta = h3lp.obj.delta(a, b);
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -54,3 +48,3 @@ });

const expected = '{"unchanged":[{"name":"a","value":1}],"children":[{"name":"b","type":"array","change":true,"delta":{"changed":[{"name":"b","new":{"code":"BR","name":"Brasil","zones":[{"code":"Belén","gmt":-3},{"code":"Manaos","gmt":-4},{"code":"Rio Branco ","gmt":-5}]},"old":{"code":"BR","name":"Brasil","zones":[{"code":"Belén","gmt":-3},{"code":"Manaos","gmt":-4},{"code":"Rio Blanco ","gmt":-5}]},"delta":{"unchanged":[{"name":"code","value":"BR"},{"name":"name","value":"Brasil"}],"children":[{"name":"zones","type":"array","change":true,"delta":{"unchanged":[{"name":"zones","value":{"code":"Belén","gmt":-3}},{"name":"zones","value":{"code":"Manaos","gmt":-4}}],"new":[{"name":"zones","new":{"code":"Rio Branco ","gmt":-5}}],"remove":[{"name":"zones","old":{"code":"Rio Blanco ","gmt":-5}}]}}]}}]}}]}';
const delta = __1.h3lp.obj.delta(a, b);
const delta = h3lp.obj.delta(a, b);
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -62,3 +56,3 @@ });

const expected = '{"unchanged":[{"name":"a","value":1}],"children":[{"name":"b","type":"array","change":true,"delta":{"changed":[{"name":"b","new":{"code":"BR","name":"Brasil","zones":[{"code":"Belén","gmt":-3},{"code":"Manaos","gmt":-4},{"code":"Rio Branco ","gmt":-5}]},"old":{"code":"BR","name":"Brasil","zones":[{"code":"Belén","gmt":-3},{"code":"Manaos","gmt":-4},{"code":"Rio Branco ","gmt":-6}]},"delta":{"unchanged":[{"name":"code","value":"BR"},{"name":"name","value":"Brasil"}],"children":[{"name":"zones","type":"array","change":true,"delta":{"unchanged":[{"name":"zones","value":{"code":"Belén","gmt":-3}},{"name":"zones","value":{"code":"Manaos","gmt":-4}}],"changed":[{"name":"zones","new":{"code":"Rio Branco ","gmt":-5},"old":{"code":"Rio Branco ","gmt":-6},"delta":{"unchanged":[{"name":"code","value":"Rio Branco "}],"changed":[{"name":"gmt","new":-5,"old":-6}]}}]}}]}}]}}]}';
const delta = __1.h3lp.obj.delta(a, b);
const delta = h3lp.obj.delta(a, b);
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -70,3 +64,3 @@ });

const expected = '{"unchanged":[{"name":"a","value":1}],"children":[{"name":"b","type":"array","change":false,"delta":{"unchanged":[{"name":"b","value":{"code":"BR","name":"Brasil","zones":[{"code":"Belén","gmt":-3},{"code":"Manaos","gmt":-4},{"code":"Rio Branco ","gmt":-6}]}}]}}]}';
const delta = __1.h3lp.obj.delta(a, b, { ignore: ['b.zones.gmt'] });
const delta = h3lp.obj.delta(a, b, { ignore: ['b.zones.gmt'] });
expect(JSON.stringify(delta)).toStrictEqual(expected);

@@ -73,0 +67,0 @@ });

export {};
//# sourceMappingURL=string.test.d.ts.map

@@ -1,72 +0,68 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-unused-vars */
const __1 = require("../../");
import { h3lp } from '../../index';
describe('string', () => {
const context = JSON.parse('{}');
test('capitalize', () => {
expect(__1.h3lp.str.capitalize('hello world')).toStrictEqual('Hello world');
expect(__1.h3lp.str.capitalize('house')).toStrictEqual('House');
expect(h3lp.str.capitalize('hello world')).toStrictEqual('Hello world');
expect(h3lp.str.capitalize('house')).toStrictEqual('House');
});
test('notation camelCase', () => {
expect(__1.h3lp.str.notation('hello world', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('house', "camel")).toStrictEqual('house');
expect(__1.h3lp.str.notation('hello-world', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('hello_world', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('hello.world', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('HELLO_WORLD', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('helloWorld', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('HelloWorld', "camel")).toStrictEqual('helloWorld');
expect(__1.h3lp.str.notation('HelloWORLD', "camel")).toStrictEqual('helloWorld');
expect(h3lp.str.notation('hello world', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('house', 'camel')).toStrictEqual('house');
expect(h3lp.str.notation('hello-world', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('hello_world', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('hello.world', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('HELLO_WORLD', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('helloWorld', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('HelloWorld', 'camel')).toStrictEqual('helloWorld');
expect(h3lp.str.notation('HelloWORLD', 'camel')).toStrictEqual('helloWorld');
});
test('notation pascalCase', () => {
expect(__1.h3lp.str.notation('hello world', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('house', "pascal")).toStrictEqual('House');
expect(__1.h3lp.str.notation('hello-world', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('hello_world', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('hello.world', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('HELLO_WORLD', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('helloWorld', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('HelloWorld', "pascal")).toStrictEqual('HelloWorld');
expect(__1.h3lp.str.notation('HelloWORLD', "pascal")).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('hello world', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('house', 'pascal')).toStrictEqual('House');
expect(h3lp.str.notation('hello-world', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('hello_world', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('hello.world', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('HELLO_WORLD', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('helloWorld', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('HelloWorld', 'pascal')).toStrictEqual('HelloWorld');
expect(h3lp.str.notation('HelloWORLD', 'pascal')).toStrictEqual('HelloWorld');
});
test('initCap', () => {
expect(__1.h3lp.str.initCap('Lo peor que hacen los malos es obligarnos a dudar de los buenos')).toStrictEqual('Lo Peor Que Hacen Los Malos Es Obligarnos A Dudar De Los Buenos');
expect(__1.h3lp.str.initCap('El dinero no puede comprar la vida')).toStrictEqual('El Dinero No Puede Comprar La Vida');
expect(__1.h3lp.str.initCap('Los hermanos sean unidos porque ésa es la ley primera')).toStrictEqual('Los Hermanos Sean Unidos Porque Ésa Es La Ley Primera');
expect(h3lp.str.initCap('Lo peor que hacen los malos es obligarnos a dudar de los buenos')).toStrictEqual('Lo Peor Que Hacen Los Malos Es Obligarnos A Dudar De Los Buenos');
expect(h3lp.str.initCap('El dinero no puede comprar la vida')).toStrictEqual('El Dinero No Puede Comprar La Vida');
expect(h3lp.str.initCap('Los hermanos sean unidos porque ésa es la ley primera')).toStrictEqual('Los Hermanos Sean Unidos Porque Ésa Es La Ley Primera');
});
test('normalize', () => {
expect(__1.h3lp.str.normalize('abcdefghijklmnopqrstuvwxyz')).toStrictEqual('abcdefghijklmnopqrstuvwxyz');
expect(__1.h3lp.str.normalize('0123456789')).toStrictEqual('0123456789');
expect(__1.h3lp.str.normalize('ABCDEFGHIJKLMNOPQRSTUVWXYZ')).toStrictEqual('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
expect(__1.h3lp.str.normalize('Ø ø')).toStrictEqual('00');
expect(__1.h3lp.str.normalize('À Á Â Ã Ä Å à á â ã ä å Ā ā Ă ă Ą ą Ƌ ƌ Ǎ ǎ Ȁ ȁ Ȃ ȃ Ȧ ȧ')).toStrictEqual('AAAAAAaaaaaaAaAaAaaaAaAaAaAa');
expect(__1.h3lp.str.normalize('ƀ Ɓ Ƃ ƃ')).toStrictEqual('bbbb');
expect(__1.h3lp.str.normalize('Ç ç Ć ć Ĉ ĉ Ċ ċ Č č Ɔ Ƈ ƈ')).toStrictEqual('CcCcCcCcCcCCc');
expect(__1.h3lp.str.normalize('Ď ď Đ đ Ɖ Ɗ ȡ')).toStrictEqual('DdDdDDd');
expect(__1.h3lp.str.normalize('È É Ê Ëè é ê ë Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Œ œ Ǝ Ɛ ǝ Ȅ ȅ Ȇ ȇ Ȩ ȩ')).toStrictEqual('EEEEeeeeEeEeEeEeEeEeEEeEeEeEe');
expect(__1.h3lp.str.normalize('Ƒ ƒ')).toStrictEqual('Ff');
expect(__1.h3lp.str.normalize('Ì Í Î Ïì í î ï')).toStrictEqual('IIIIiiii');
expect(__1.h3lp.str.normalize('Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ɠ Ǥ ǥ Ǧ ǧ Ǵ ǵ')).toStrictEqual('GgGgGgGgGGgGgGg');
expect(__1.h3lp.str.normalize('Ĥ ĥ Ħ ħ Ȟ ȟ')).toStrictEqual('HhHhHh');
expect(__1.h3lp.str.normalize('Ĩ ĩ Ī ī Ĭ ĭ Į į İ Ɨ Ǐ ǐ Ȉ ȉ Ȋ ȋ')).toStrictEqual('IiIiIiIiIIIiIiIi');
expect(__1.h3lp.str.normalize('Ĵ ĵ')).toStrictEqual('JJ');
expect(__1.h3lp.str.normalize('Ƙ ƙ Ǩ ǩ')).toStrictEqual('KkKk');
expect(__1.h3lp.str.normalize('Ĺ ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł ƚ')).toStrictEqual('LlLlLlLlLll');
expect(__1.h3lp.str.normalize('Ñ ñ Ń ń Ņ ņ Ň ň Ɲ ƞ Ǹ ǹ Ƞ')).toStrictEqual('NnNnNnNnNnNnN');
expect(__1.h3lp.str.normalize('Ò Ó Ô Õ Ö ò ó ô õ ö Ō ō Ŏ ŏ Ő ő Ɵ Ơ ơ Ǒ ǒ Ȍ ȍ Ȏ ȏ Ȯ ȯ')).toStrictEqual('OOOOOoooooOoOoOoOOoOoOoOoOo');
expect(__1.h3lp.str.normalize('Ƥ ƥ')).toStrictEqual('Pp');
expect(__1.h3lp.str.normalize('Ǫ ǫ')).toStrictEqual('QQ');
expect(__1.h3lp.str.normalize('Ŕ ŕ Ŗ ŗ Ř ř Ʀ Ȑ ȑ Ȓ ȓ')).toStrictEqual('RrRrRrRRrRr');
expect(__1.h3lp.str.normalize('Ś ś Ŝ ŝ Ş ş Š š Ș ș')).toStrictEqual('SsSsSsSsSs');
expect(__1.h3lp.str.normalize('Ţ ţ Ť ť Ŧ ŧ ƫ Ƭ ƭ Ʈ Ț ț')).toStrictEqual('TtTtTttTtTT');
expect(__1.h3lp.str.normalize('Ù Ú Û Ü ù ú û ü Ũ ũ Ū ū Ŭ ŭ Ů ů Ű ű Ư ư Ʋ Ǔ ǔ Ȕ ȕ Ȗ ȗ')).toStrictEqual('UUUUuuuuUuUuUuUuUuUuuUuUuUu');
expect(__1.h3lp.str.normalize('Ý ý ÿ Ų ų')).toStrictEqual('YyyYy');
expect(__1.h3lp.str.normalize('Ŵ ŵ')).toStrictEqual('Ww');
expect(__1.h3lp.str.normalize(' Ŷ ŷ Ÿ Ȳ ȳ')).toStrictEqual('YyYYy');
expect(__1.h3lp.str.normalize('Ɯ')).toStrictEqual('W');
expect(__1.h3lp.str.normalize('Ƴ ƴ')).toStrictEqual('yy');
expect(__1.h3lp.str.normalize('Ź ź Ż ż Ž ž Ƶ ƶ Ȥ ȥ')).toStrictEqual('ZzZzZzZzZz');
expect(h3lp.str.normalize('abcdefghijklmnopqrstuvwxyz')).toStrictEqual('abcdefghijklmnopqrstuvwxyz');
expect(h3lp.str.normalize('0123456789')).toStrictEqual('0123456789');
expect(h3lp.str.normalize('ABCDEFGHIJKLMNOPQRSTUVWXYZ')).toStrictEqual('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
expect(h3lp.str.normalize('Ø ø')).toStrictEqual('00');
expect(h3lp.str.normalize('À Á Â Ã Ä Å à á â ã ä å Ā ā Ă ă Ą ą Ƌ ƌ Ǎ ǎ Ȁ ȁ Ȃ ȃ Ȧ ȧ')).toStrictEqual('AAAAAAaaaaaaAaAaAaaaAaAaAaAa');
expect(h3lp.str.normalize('ƀ Ɓ Ƃ ƃ')).toStrictEqual('bbbb');
expect(h3lp.str.normalize('Ç ç Ć ć Ĉ ĉ Ċ ċ Č č Ɔ Ƈ ƈ')).toStrictEqual('CcCcCcCcCcCCc');
expect(h3lp.str.normalize('Ď ď Đ đ Ɖ Ɗ ȡ')).toStrictEqual('DdDdDDd');
expect(h3lp.str.normalize('È É Ê Ëè é ê ë Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Œ œ Ǝ Ɛ ǝ Ȅ ȅ Ȇ ȇ Ȩ ȩ')).toStrictEqual('EEEEeeeeEeEeEeEeEeEeEEeEeEeEe');
expect(h3lp.str.normalize('Ƒ ƒ')).toStrictEqual('Ff');
expect(h3lp.str.normalize('Ì Í Î Ïì í î ï')).toStrictEqual('IIIIiiii');
expect(h3lp.str.normalize('Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ɠ Ǥ ǥ Ǧ ǧ Ǵ ǵ')).toStrictEqual('GgGgGgGgGGgGgGg');
expect(h3lp.str.normalize('Ĥ ĥ Ħ ħ Ȟ ȟ')).toStrictEqual('HhHhHh');
expect(h3lp.str.normalize('Ĩ ĩ Ī ī Ĭ ĭ Į į İ Ɨ Ǐ ǐ Ȉ ȉ Ȋ ȋ')).toStrictEqual('IiIiIiIiIIIiIiIi');
expect(h3lp.str.normalize('Ĵ ĵ')).toStrictEqual('JJ');
expect(h3lp.str.normalize('Ƙ ƙ Ǩ ǩ')).toStrictEqual('KkKk');
expect(h3lp.str.normalize('Ĺ ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł ƚ')).toStrictEqual('LlLlLlLlLll');
expect(h3lp.str.normalize('Ñ ñ Ń ń Ņ ņ Ň ň Ɲ ƞ Ǹ ǹ Ƞ')).toStrictEqual('NnNnNnNnNnNnN');
expect(h3lp.str.normalize('Ò Ó Ô Õ Ö ò ó ô õ ö Ō ō Ŏ ŏ Ő ő Ɵ Ơ ơ Ǒ ǒ Ȍ ȍ Ȏ ȏ Ȯ ȯ')).toStrictEqual('OOOOOoooooOoOoOoOOoOoOoOoOo');
expect(h3lp.str.normalize('Ƥ ƥ')).toStrictEqual('Pp');
expect(h3lp.str.normalize('Ǫ ǫ')).toStrictEqual('QQ');
expect(h3lp.str.normalize('Ŕ ŕ Ŗ ŗ Ř ř Ʀ Ȑ ȑ Ȓ ȓ')).toStrictEqual('RrRrRrRRrRr');
expect(h3lp.str.normalize('Ś ś Ŝ ŝ Ş ş Š š Ș ș')).toStrictEqual('SsSsSsSsSs');
expect(h3lp.str.normalize('Ţ ţ Ť ť Ŧ ŧ ƫ Ƭ ƭ Ʈ Ț ț')).toStrictEqual('TtTtTttTtTT');
expect(h3lp.str.normalize('Ù Ú Û Ü ù ú û ü Ũ ũ Ū ū Ŭ ŭ Ů ů Ű ű Ư ư Ʋ Ǔ ǔ Ȕ ȕ Ȗ ȗ')).toStrictEqual('UUUUuuuuUuUuUuUuUuUuuUuUuUu');
expect(h3lp.str.normalize('Ý ý ÿ Ų ų')).toStrictEqual('YyyYy');
expect(h3lp.str.normalize('Ŵ ŵ')).toStrictEqual('Ww');
expect(h3lp.str.normalize(' Ŷ ŷ Ÿ Ȳ ȳ')).toStrictEqual('YyYYy');
expect(h3lp.str.normalize('Ɯ')).toStrictEqual('W');
expect(h3lp.str.normalize('Ƴ ƴ')).toStrictEqual('yy');
expect(h3lp.str.normalize('Ź ź Ż ż Ž ž Ƶ ƶ Ȥ ȥ')).toStrictEqual('ZzZzZzZzZz');
});
});
//# sourceMappingURL=string.test.js.map
export {};
//# sourceMappingURL=utils.test.d.ts.map

@@ -1,13 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable no-template-curly-in-string */
const __1 = require("../../");
import { h3lp } from '../../index';
describe('utils', () => {
const context = JSON.parse('{"firstName":"Pedro","lastName":"Brieger","portal":"www.nodal.am","orders":[{"number":"20001","customer":{"firstName":"John","lastName":"Murphy"},"orderTime":"2022-07-30T10:15:54","details":[{"article":"Pear","unitPrice":1.78,"qty":2},{"article":"Banana","unitPrice":1.99,"qty":1},{"article":"White grape","unitPrice":2.03,"qty":1}]},{"number":"20002","customer":{"firstName":"Paul","lastName":"Smith"},"orderTime":"2022-07-30T12:12:43","details":[{"article":"Apple","unitPrice":2.15,"qty":1},{"article":"Banana","unitPrice":1.99,"qty":2},{"article":"Pear","unitPrice":1.78,"qty":1}]}]}');
test('template', () => {
expect(__1.h3lp.utils.template('${firstName} ${lastName} es el autor del portal ${portal}', context)).toStrictEqual('Pedro Brieger es el autor del portal www.nodal.am');
expect(__1.h3lp.utils.template('order number ${orders.0.number}', context)).toStrictEqual('order number 20001');
expect(__1.h3lp.utils.template('no existe ${noExiste}', context)).toStrictEqual('no existe ${noExiste}');
expect(h3lp.utils.template('${firstName} ${lastName} es el autor del portal ${portal}', context)).toStrictEqual('Pedro Brieger es el autor del portal www.nodal.am');
expect(h3lp.utils.template('order number ${orders.0.number}', context)).toStrictEqual('order number 20001');
expect(h3lp.utils.template('no existe ${noExiste}', context)).toStrictEqual('no existe ${noExiste}');
});
});
//# sourceMappingURL=utils.test.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc