From 63414e9237cc52b401b16b7a8ca568a74b721f36 Mon Sep 17 00:00:00 2001 From: Ahmed Abuzeid <67832074+Abuzeid1@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:08:45 +0300 Subject: [PATCH] fix: replace is-number dependency with a one liner (#20) * fix: replace is-number dependency with a one liner --- lib/formatter/index.js | 3 +-- package.json | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/formatter/index.js b/lib/formatter/index.js index d92288f..435ebd5 100644 --- a/lib/formatter/index.js +++ b/lib/formatter/index.js @@ -1,4 +1,3 @@ -const isNumber = require('is-number'); const betterror = require('../betterror'); const sanitiser = require('../sanitiser'); const types = require('../types'); @@ -83,7 +82,7 @@ module.exports = function formatter({ prefix, sanitise = sanitiser, scheme = 'da if (typeof value === 'bigint') { value = Number(process.hrtime.bigint() - value) / 1e6; } - if (typeof value !== 'number' || !isNumber(value)) { + if (typeof value !== 'number' || value - value !== 0) { throw betterror(new TypeError(`Expected 'value' to be a number, instead got ${value} (${typeof value})`), { type, key, value, rate, tags }); } diff --git a/package.json b/package.json index 74c1dd1..1811843 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fiverr/statsd-client", - "version": "1.1.1", + "version": "1.1.2", "description": "📈 A feature packed, highly customisable StatsD client", "keywords": [ "StatsD", @@ -31,9 +31,6 @@ "test": "mocha 'spec.js' '**/spec.js' --require .mocha", "lint": "eslint '.*.js' '*.js' '**/*.js'" }, - "dependencies": { - "is-number": "^7.0.0" - }, "devDependencies": { "@fiverr/eslint-config-fiverr": "^3.2.4", "@lets/wait": "^2.0.2",