@applitools/utils
Advanced tools
Comparing version 1.3.28 to 1.3.29
@@ -30,6 +30,6 @@ "use strict"; | ||
if (!process) | ||
return; | ||
return undefined; | ||
const value = process.env[`APPLITOOLS_${name}`]; | ||
if (value === undefined || value === 'null') | ||
return; | ||
return undefined; | ||
if (type === 'boolean') | ||
@@ -79,3 +79,3 @@ return ['true', true, '1', 1].includes(value); | ||
function toString(object) { | ||
return `${this.constructor.name} ${JSON.stringify(object, null, 2)}`; | ||
return `${object.constructor.name} ${JSON.stringify(object, null, 2)}`; | ||
} | ||
@@ -82,0 +82,0 @@ exports.toString = toString; |
@@ -101,3 +101,3 @@ "use strict"; | ||
} | ||
if (types.has(target, ['x', 'y'])) { | ||
if (types.has(target, ['x', 'y']) && size) { | ||
const hasSize = types.has(target, ['width', 'height']); | ||
@@ -211,2 +211,3 @@ // rotate coordinate system around a target | ||
} | ||
return false; | ||
} | ||
@@ -250,20 +251,12 @@ exports.equals = equals; | ||
function padding(region, padding) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e, _f; | ||
if (types.isNumber(padding)) { | ||
padding = { left: padding, right: padding, top: padding, bottom: padding }; | ||
} | ||
else { | ||
padding = { | ||
left: (_a = padding === null || padding === void 0 ? void 0 : padding.left) !== null && _a !== void 0 ? _a : 0, | ||
right: (_b = padding === null || padding === void 0 ? void 0 : padding.right) !== null && _b !== void 0 ? _b : 0, | ||
top: (_c = padding === null || padding === void 0 ? void 0 : padding.top) !== null && _c !== void 0 ? _c : 0, | ||
bottom: (_d = padding === null || padding === void 0 ? void 0 : padding.bottom) !== null && _d !== void 0 ? _d : 0, | ||
}; | ||
} | ||
region.x -= padding.left; | ||
region.width += padding.left + padding.right; | ||
region.y -= padding.top; | ||
region.height += padding.top + padding.bottom; | ||
region.x -= (_a = padding.left) !== null && _a !== void 0 ? _a : 0; | ||
region.width += ((_b = padding.left) !== null && _b !== void 0 ? _b : 0) + ((_c = padding.right) !== null && _c !== void 0 ? _c : 0); | ||
region.y -= (_d = padding.top) !== null && _d !== void 0 ? _d : 0; | ||
region.height += ((_e = padding.top) !== null && _e !== void 0 ? _e : 0) + ((_f = padding.bottom) !== null && _f !== void 0 ? _f : 0); | ||
return region; | ||
} | ||
exports.padding = padding; |
@@ -74,4 +74,4 @@ "use strict"; | ||
if (error) | ||
resolve({ stdout, stderr, code: error.code }); | ||
resolve({ stdout, stderr, code: 0 }); | ||
resolve({ stdout: stdout.toString('utf8'), stderr: stderr.toString('utf8'), code: error.code }); | ||
resolve({ stdout: stdout.toString('utf8'), stderr: stderr.toString('utf8'), code: 0 }); | ||
}); | ||
@@ -78,0 +78,0 @@ }); |
{ | ||
"name": "@applitools/utils", | ||
"version": "1.3.28", | ||
"version": "1.3.29", | ||
"keywords": [ | ||
@@ -48,4 +48,4 @@ "applitools", | ||
"scripts": { | ||
"lint": "eslint '**/*.ts'", | ||
"build": "tsc", | ||
"lint": "npx eslint '**/*.ts'", | ||
"build": "npx tsc --project ./tsconfig.build.json", | ||
"test": "yarn test:unit", | ||
@@ -55,11 +55,6 @@ "test:sanity": "yarn test:unit", | ||
"deps": "bongo deps", | ||
"preversion": "bongo preversion && yarn build", | ||
"preversion": "bongo preversion", | ||
"version": "bongo version", | ||
"postversion": "bongo postversion --skip-release-notification" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "yarn bongo lint" | ||
} | ||
}, | ||
"dependencies": {}, | ||
@@ -70,12 +65,3 @@ "devDependencies": { | ||
"@types/node": "12", | ||
"@typescript-eslint/eslint-plugin": "^5.27.0", | ||
"@typescript-eslint/parser": "^5.27.0", | ||
"eslint": "^8.16.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^4.3.8", | ||
"mocha": "^10.0.0", | ||
"prettier": "^2.1.2", | ||
"ts-node": "^10.8.0", | ||
"typescript": "^4.9.4" | ||
"mocha": "^10.0.0" | ||
}, | ||
@@ -82,0 +68,0 @@ "engines": { |
@@ -1,5 +0,5 @@ | ||
export declare function getEnvValue<T extends 'boolean' | 'number' | 'string' = 'string'>(name: string, type?: T): T extends 'boolean' ? boolean : T extends 'number' ? number : string; | ||
export declare function getEnvValue<T extends 'boolean' | 'number' | 'string' = 'string'>(name: string, type?: T): T extends 'boolean' ? boolean : T extends 'number' ? number : T extends 'string' ? string : string | undefined; | ||
export declare function guid(): string; | ||
export declare function jwtDecode(token: string): Record<string, any>; | ||
export declare function sleep(ms: number): Promise<unknown>; | ||
export declare function sleep(ms: number): Promise<unknown> | undefined; | ||
export declare function toJSON<TObject extends Record<PropertyKey, any>, TKey extends string, TProps extends Readonly<TKey[]>>(object: TObject, props: TProps): { | ||
@@ -6,0 +6,0 @@ [key in TProps[number]]: TObject[key] extends { |
import type { Location, Size, Region } from './utility-types'; | ||
export declare function location(region: Region): Location; | ||
export declare function size(region: Region): Size; | ||
export declare function location<TLocatable extends Location>(region: TLocatable): Location; | ||
export declare function size<TSizable extends Size>(region: TSizable): Size; | ||
export declare function region(location: Location, size: Size): { | ||
@@ -5,0 +5,0 @@ x: number; |
@@ -13,5 +13,5 @@ export declare function isNotDefined(value: any): boolean; | ||
export declare function isPlainObject(value: any): value is Record<PropertyKey, any>; | ||
export declare function isEmpty(value: Record<PropertyKey, unknown>): value is Record<PropertyKey, never>; | ||
export declare function isEmpty(value: any[]): value is []; | ||
export declare function isEmpty(value: string): value is ''; | ||
export declare function isEmpty(value: Record<PropertyKey, unknown> | undefined | null): value is Record<PropertyKey, never>; | ||
export declare function isEmpty(value: any[] | undefined | null): value is []; | ||
export declare function isEmpty(value: string | undefined | null): value is ''; | ||
export declare function isFunction(value: any): value is (...args: any[]) => any; | ||
@@ -18,0 +18,0 @@ export declare function isFunction<TKey extends PropertyKey>(value: any, key: TKey): value is { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
71477
1294