From 77274d18fe7ef3c1d4a8d2379d78f30d3f5471a9 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 10 Apr 2026 12:41:34 +0100 Subject: [PATCH] chore: remove unused dependencies, inline tiny utils --- package.json | 2 -- quad.js | 12 ++++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 852f72e..5fe5331 100644 --- a/package.json +++ b/package.json @@ -41,11 +41,9 @@ "license": "MIT", "dependencies": { "array-bounds": "^1.0.1", - "clamp": "^1.0.1", "defined": "^1.0.0", "dtype": "^2.0.0", "flatten-vertex-data": "^1.0.2", - "is-obj": "^1.0.1", "math-log2": "^1.0.1", "parse-rect": "^1.2.0", "pick-by-alias": "^1.2.0" diff --git a/quad.js b/quad.js index c5fe18f..54cc432 100644 --- a/quad.js +++ b/quad.js @@ -6,13 +6,11 @@ 'use strict' -const clamp = require('clamp') const rect = require('parse-rect') const getBounds = require('array-bounds') const pick = require('pick-by-alias') const defined = require('defined') const flatten = require('flatten-vertex-data') -const isObj = require('is-obj') const dtype = require('dtype') const log2 = require('math-log2') @@ -270,6 +268,16 @@ module.exports = function cluster (srcPoints, options) { } +function isObj(value) { + return value && typeof value === 'object' +} + +function clamp(value, min, max) { + return min < max + ? (value < min ? min : value > max ? max : value) + : (value < max ? max : value > min ? min : value) +} + // normalize points by bounds function normalize (pts, bounds) { let [lox, loy, hix, hiy] = bounds