From ea2aacae3d2936bec74624d1616536ce573e97cc Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Sun, 16 Nov 2025 14:24:28 -0300 Subject: [PATCH] feat(is): add Deno and Node validation --- package-lock.json | 4 ++-- package.json | 2 +- src/helpers/Is.ts | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7eae4f6..ab025a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/common", - "version": "5.25.0", + "version": "5.26.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/common", - "version": "5.25.0", + "version": "5.26.0", "license": "MIT", "dependencies": { "@fastify/formbody": "^8.0.2", diff --git a/package.json b/package.json index 26ba27d..7c8bd09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/common", - "version": "5.25.0", + "version": "5.26.0", "description": "The Athenna common helpers to use in any Node.js ESM project.", "license": "MIT", "author": "João Lenon ", diff --git a/src/helpers/Is.ts b/src/helpers/Is.ts index eb22659..f3994b1 100644 --- a/src/helpers/Is.ts +++ b/src/helpers/Is.ts @@ -38,6 +38,22 @@ export class Is extends Macroable { return kind } + /** + * Verify if the current runtime is Node. + */ + public static Node(): boolean { + return typeof process !== 'undefined' && process.versions?.node !== null + } + + /** + * Verify if the current runtime is Deno. + */ + public static Deno(): boolean { + // eslint-disable-next-line + // @ts-ignore + return typeof Deno !== 'undefined' && Deno.version !== null + } + /** * Verify if the current platform is Linux. */