From bc628bbd82ed3353770776443350c06b408e4216 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 10 Apr 2026 12:46:51 +0100 Subject: [PATCH] chore: inline `clamp` and `is-obj` dependencies --- package.json | 2 -- quad.js | 11 +++++++++-- 2 files changed, 9 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..9d4cce6 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') @@ -269,6 +267,15 @@ 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) {