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

@applitools/utils

Package Overview
Dependencies
Maintainers
22
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/utils - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Changelog

## 1.2.2 - 2021/8/7
- add `geometry.rotate` to rotate region and sizes to on certain number of degrees
## 1.2.1 - 2021/8/3

@@ -8,0 +12,0 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.divide = exports.equals = exports.contains = exports.isIntersected = exports.subtraction = exports.intersect = exports.offsetNegative = exports.offset = exports.scale = exports.isEmpty = exports.region = exports.size = exports.location = void 0;
exports.divide = exports.equals = exports.contains = exports.isIntersected = exports.subtraction = exports.intersect = exports.offsetNegative = exports.offset = exports.scale = exports.rotate = exports.round = exports.isEmpty = exports.region = exports.size = exports.location = void 0;
const types = require("./types");

@@ -24,2 +24,25 @@ const guard = require("./guard");

exports.isEmpty = isEmpty;
function round(target) {
const result = Object.assign({}, target);
if (types.has(target, ['x', 'y'])) {
result.x = Math.round(target.x);
result.y = Math.round(target.y);
}
if (types.has(target, ['width', 'height'])) {
result.width = Math.round(target.width);
result.height = Math.round(target.height);
}
return result;
}
exports.round = round;
function rotate(target, degree) {
const result = Object.assign({}, target);
const rotate = Boolean(Math.floor(degree / 90) % 2);
if (rotate) {
result.width = target.height;
result.height = target.width;
}
return result;
}
exports.rotate = rotate;
function scale(target, scaleRatio) {

@@ -138,4 +161,4 @@ const result = Object.assign({}, target);

// last region
else if (nextY + padding.bottom >= maxY)
nextY += padding.bottom;
else if (nextY < maxY && nextY + padding.top >= maxY)
nextY = maxY;
const currentHeight = nextY - currentY;

@@ -142,0 +165,0 @@ let currentX = region.x;

2

package.json
{
"name": "@applitools/utils",
"version": "1.2.1",
"version": "1.2.2",
"keywords": [

@@ -5,0 +5,0 @@ "applitools",

@@ -20,2 +20,7 @@ declare type Location = {

export declare function isEmpty(region: Region): boolean;
export declare function round(region: Region): Region;
export declare function round(region: RectangleSize): RectangleSize;
export declare function round(region: Location): Location;
export declare function rotate(region: Region, degree: number): Region;
export declare function rotate(size: RectangleSize, degree: number): RectangleSize;
export declare function scale(region: Region, scaleRatio: number): Region;

@@ -22,0 +27,0 @@ export declare function scale(size: RectangleSize, scaleRatio: number): RectangleSize;

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