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

path-intersection

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-intersection - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

4

CHANGELOG.md

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

## 2.1.0
* `CHORE`: various code cleanups
## 2.0.2

@@ -11,0 +15,0 @@

74

intersect.js

@@ -22,2 +22,4 @@ 'use strict';

var isArray = Array.isArray || function(o) { return o instanceof Array; };
function hasProperty(obj, property) {

@@ -27,19 +29,2 @@ return Object.prototype.hasOwnProperty.call(obj, property);

function is(o, type) {
type = String.prototype.toLowerCase.call(type);
if (type == 'finite') {
return isFinite(o);
}
if (type == 'array' && (o instanceof Array || Array.isArray && Array.isArray(o))) {
return true;
}
return (type == 'null' && o === null) ||
(type == typeof o && o !== null) ||
(type == 'object' && o === Object(o)) ||
Object.prototype.toString.call(o).slice(8, -1).toLowerCase() == type;
}
function clone(obj) {

@@ -68,3 +53,3 @@

function cacher(f, scope, postprocessor) {
function cacher(f) {

@@ -80,3 +65,3 @@ function newf() {

repush(count, args);
return postprocessor ? postprocessor(cache[args]) : cache[args];
return cache[args];
}

@@ -86,5 +71,5 @@

count.push(args);
cache[args] = f.apply(scope, arg);
cache[args] = f.apply(0, arg);
return postprocessor ? postprocessor(cache[args]) : cache[args];
return cache[args];
}

@@ -109,3 +94,3 @@ return newf;

if (is(pathString, 'array') && is(pathString[0], 'array')) { // rough assumption
if (isArray(pathString) && isArray(pathString[0])) { // rough assumption
data = clone(pathString);

@@ -168,3 +153,3 @@ }

function box(x, y, width, height) {
function rectBBox(x, y, width, height) {

@@ -182,14 +167,5 @@ if (arguments.length === 1) {

width: width,
w: width,
height: height,
h: height,
x2: x + width,
y2: y + height,
cx: x + width / 2,
cy: y + height / 2,
r1: math.min(width, height) / 2,
r2: math.max(width, height) / 2,
r0: math.sqrt(width * width + height * height) / 2,
path: rectPath(x, y, width, height),
vb: [x, y, width, height].join(' ')
y2: y + height
};

@@ -227,3 +203,3 @@ }

return box(
return rectBBox(
bbox.x0,

@@ -244,4 +220,4 @@ bbox.y0,

function isBBoxIntersect(bbox1, bbox2) {
bbox1 = box(bbox1);
bbox2 = box(bbox2);
bbox1 = rectBBox(bbox1);
bbox2 = rectBBox(bbox2);
return isPointInsideBBox(bbox2, bbox1.x, bbox1.y)

@@ -432,3 +408,3 @@ || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y)

* // { x: 50, y: 50, segment1: 1, segment2: 1, t1: 0.5, t2: 0.5 }
* //
* // ]
*

@@ -508,24 +484,2 @@ * @param {String|Array<PathDef>} path1

function rectPath(x, y, w, h, r) {
if (r) {
return [
['M', +x + (+r), y],
['l', w - r * 2, 0],
['a', r, r, 0, 0, 1, r, r],
['l', 0, h - r * 2],
['a', r, r, 0, 0, 1, -r, r],
['l', r * 2 - w, 0],
['a', r, r, 0, 0, 1, -r, -r],
['l', 0, r * 2 - h],
['a', r, r, 0, 0, 1, r, -r],
['z']
];
}
var res = [['M', x, y], ['l', w, 0], ['l', 0, h], ['l', -w, 0], ['z']];
res.toString = pathToString;
return res;
}
function pathToAbsolute(pathArray) {

@@ -538,3 +492,3 @@ var pth = paths(pathArray);

if (!is(pathArray, 'array') || !is(pathArray && pathArray[0], 'array')) { // rough assumption
if (!isArray(pathArray) || !isArray(pathArray && pathArray[0])) { // rough assumption
pathArray = parsePathString(pathArray);

@@ -541,0 +495,0 @@ }

{
"name": "path-intersection",
"version": "2.0.2",
"version": "2.1.0",
"description": "Computes the intersection between two SVG paths",

@@ -5,0 +5,0 @@ "main": "intersect.js",

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