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

oberknecht-utils

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oberknecht-utils - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

lib/utils/isNullUndefined.js

1

index.js

@@ -29,2 +29,3 @@ require("./lib/utils/cleanChannelName");

require("./lib/utils/returnOnNumber");
require("./lib/utils/isNullUndefined");

@@ -31,0 +32,0 @@ require("./lib/variables/regex");

@@ -30,2 +30,3 @@ class oberknechtUtils {

static returnOnNumber = require("./returnOnNumber");
static isNullUndefined = require("./isNullUndefined");

@@ -32,0 +33,0 @@ static regex = require("../variables/regex");

15

lib/utils/returnOnNumber.js
const extendedTypeof = require("./extendedTypeof");
const isNullUndefined = require("./isNullUndefined");
/** @param {string | Array | Object | number | bigint} input @param {Number} targetNumber @param {any} returnOnGreater @param {any} returnOnGreaterEquals @param {any} returnOnSmaller @param {any} returnOnSmallerEquals @param {any} returnDefault */
function returnOnNumber(input, targetNumber, returnOnGreater, returnOnGreaterEquals, returnOnSmaller, returnOnSmallerEquals, returnDefault) {
if (["null", "undefined"].includes(extendedTypeof(input))) return undefined;
targetNumber = (["null", "undefined"].includes(extendedTypeof(targetNumber)) ? 2 : targetNumber);
if (isNullUndefined(extendedTypeof(input))) return undefined;
targetNumber = (isNullUndefined(extendedTypeof(targetNumber)) ? 2 : targetNumber);

@@ -18,10 +19,10 @@ let parsedSearchNumber;

if (returnOnGreater && (parsedSearchNumber > targetNumber)) return returnOnGreater;
if (returnOnGreaterEquals && (parsedSearchNumber >= targetNumber)) return returnOnGreaterEquals;
if (returnOnSmaller && (parsedSearchNumber < targetNumber)) return returnOnSmaller;
if (returnOnSmallerEquals && (parsedSearchNumber <= targetNumber)) return returnOnSmallerEquals;
if (!isNullUndefined(returnOnGreater) && (parsedSearchNumber > targetNumber)) return returnOnGreater;
if (!isNullUndefined(returnOnGreaterEquals) && (parsedSearchNumber >= targetNumber)) return returnOnGreaterEquals;
if (!isNullUndefined(returnOnSmaller) && (parsedSearchNumber < targetNumber)) return returnOnSmaller;
if (!isNullUndefined(returnOnSmallerEquals) && (parsedSearchNumber <= targetNumber)) return returnOnSmallerEquals;
return (returnDefault ?? "");
return (!isNullUndefined(returnDefault) ? returnDefault : "");
};
module.exports = returnOnNumber;
{
"name": "oberknecht-utils",
"version": "0.2.1",
"version": "0.2.2",
"description": "Utils for oberknecht packages",

@@ -5,0 +5,0 @@ "main": "index.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