New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rjweb/utils

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjweb/utils - npm Package Compare versions

Comparing version 1.12.26 to 1.12.27

42

lib/cjs/number.js

@@ -28,5 +28,9 @@ "use strict";

TAU: () => TAU,
acos: () => acos,
asin: () => asin,
atan: () => atan,
between: () => between,
change: () => change,
clamp: () => clamp,
cos: () => cos,
factorial: () => factorial,

@@ -46,2 +50,6 @@ factors: () => factors,

round: () => round,
sin: () => sin,
tan: () => tan,
toDegrees: () => toDegrees,
toRadians: () => toRadians,
triangle: () => triangle

@@ -154,3 +162,3 @@ });

function fraction(input, tolerance = 1e-3) {
if (!Number.isFinite(input))
if (!Number.isFinite(input) || Number.isInteger(input))
return [input, 1];

@@ -170,2 +178,26 @@ let h1 = 1, h2 = 0, k1 = 0, k2 = 1, b = input;

}
function toRadians(input) {
return input * (PI / 180);
}
function toDegrees(input) {
return input * (180 / PI);
}
function sin(input) {
return round(Math.sin(toRadians(input)), 10);
}
function asin(input) {
return round(toDegrees(Math.asin(input)), 10);
}
function cos(input) {
return round(Math.cos(toRadians(input)), 10);
}
function acos(input) {
return round(toDegrees(Math.acos(input)), 10);
}
function tan(input) {
return round(Math.tan(toRadians(input)), 10);
}
function atan(input) {
return round(toDegrees(Math.atan(input)), 10);
}
// Annotate the CommonJS export names for ESM import in node:

@@ -180,5 +212,9 @@ 0 && (module.exports = {

TAU,
acos,
asin,
atan,
between,
change,
clamp,
cos,
factorial,

@@ -198,3 +234,7 @@ factors,

round,
sin,
tan,
toDegrees,
toRadians,
triangle
});

2

lib/cjs/pckg.json
{
"name": "@rjweb/utils",
"version": "1.12.26",
"version": "1.12.27",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -105,3 +105,3 @@ const GOLDEN_RATIO = 1.618033988749895;

function fraction(input, tolerance = 1e-3) {
if (!Number.isFinite(input))
if (!Number.isFinite(input) || Number.isInteger(input))
return [input, 1];

@@ -121,2 +121,26 @@ let h1 = 1, h2 = 0, k1 = 0, k2 = 1, b = input;

}
function toRadians(input) {
return input * (PI / 180);
}
function toDegrees(input) {
return input * (180 / PI);
}
function sin(input) {
return round(Math.sin(toRadians(input)), 10);
}
function asin(input) {
return round(toDegrees(Math.asin(input)), 10);
}
function cos(input) {
return round(Math.cos(toRadians(input)), 10);
}
function acos(input) {
return round(toDegrees(Math.acos(input)), 10);
}
function tan(input) {
return round(Math.tan(toRadians(input)), 10);
}
function atan(input) {
return round(toDegrees(Math.atan(input)), 10);
}
export {

@@ -130,5 +154,9 @@ E,

TAU,
acos,
asin,
atan,
between,
change,
clamp,
cos,
factorial,

@@ -148,3 +176,7 @@ factors,

round,
sin,
tan,
toDegrees,
toRadians,
triangle
};
{
"name": "@rjweb/utils",
"version": "1.12.26",
"version": "1.12.27",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -230,1 +230,100 @@ export declare const GOLDEN_RATIO = 1.618033988749895;

*/ export declare function fraction(input: number, tolerance?: number): [number, number];
/**
* Turn given number (degrees) into radians
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.toRadians(180) // 3.141592653589793
* number.toRadians(90) // 1.5707963267948966
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function toRadians(input: number): number;
/**
* Turn given number (radians) into degrees
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.toDegrees(3.141592653589793) // 180
* number.toDegrees(1.5707963267948966) // 90
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function toDegrees(input: number): number;
/**
* Get the sine of a number (in degrees)
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.sin(0) // 0
* number.sin(90) // 1
* number.sin(45) // 0.7071067811865476
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function sin(input: number): number;
/**
* Get the inverse sine of a number (in degrees)
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.asin(0) // 0
* number.asin(1) // 90
* number.asin(0.7071067811865476) // 45
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function asin(input: number): number;
/**
* Get the cosine of a number (in degrees)
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.cos(0) // 1
* number.cos(90) // 0
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function cos(input: number): number;
/**
* Get the inverse cosine of a number (in degrees)
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.acos(1) // 0
* number.acos(0) // 90
* number.acos(0.7071067811865476) // 45
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function acos(input: number): number;
/**
* Get the tangent of a number (in degrees)
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.tan(0) // 0
* number.tan(45) // 1
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function tan(input: number): number;
/**
* Get the inverse tangent of a number (in degrees)
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.atan(0) // 0
* number.atan(1) // 45
* ```
* @since 1.12.27
* @supports nodejs, browser
*/ export declare function atan(input: number): number;
{
"name": "@rjweb/utils",
"version": "1.12.26",
"version": "1.12.27",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/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