
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@zwolfrost/get.js
Advanced tools
A JavaScript library that provides a bunch of useful, optimized and often math-related functions
A JavaScript library that provides a bunch of useful, optimized and often math-related functions.
All versions are written in vanilla javascript (ES12) and have no dependencies.
Version | Methods Available | JSDOC Documentation | Minification |
---|---|---|---|
get.js | All methods | :heavy_check_mark: | :x: |
get.min.js | All methods | :x: | :heavy_check_mark: |
You can just install it like any npm package,
npm i @zwolfrost/get.js
use a cdn or copy the file from the src directory.
Watch out for this section if you wish to migrate to a different version.
New patches are usually bugfixes and/or documentation clarifications and only meaningful ones are written.
window[name](...args)
Note that you can change the cdn version and/or package type of the library with whatever version you want. Template:
https://cdn.jsdelivr.net/npm/package@version/file
.
Also note that you have to use an ES module to import as seen below, unless you want to use the CDN method
import get from "@zwolfrost/get.js";
//OR
import get from "https://cdn.jsdelivr.net/npm/@zwolfrost/get.js@1.1/src/get.js";
get.fraction(1.375, 2)
//returns [ 227, 165 ] because 227/165 = 1.3757575...
Instructions on parameters and details can be found in the JSDOC comments
Method | Description |
---|---|
intervals | Returns an array that contains the intervalling numbers between the two given numbers (or arrays). |
pattern | Returns an array made up of the given length and number pattern. |
unique | Returns an array made up of unique numbers (that never repeat) from the given one. |
decimals | Returns the number of decimals in the given number. |
fraction | Returns a fraction calculated from the given decimal number. Also works with repeating decimals, if specified. |
random | Returns a random number between the two given numbers (inclusive). |
normalized | Returns a normalized version of the given string (latin letters only). |
time | Returns the current time of the day. |
GCD | Returns the greatest common divisor between two given numbers. |
LCM | Returns the least common multiple between two given numbers. |
prime_factors | Returns an array that contains the prime numbers that multiply together to make the original number. |
extracted_root | Returns an array that contains the extracted number and the one left in the root. |
root | Returns the result of a root with the given number and index. |
base | Returns a converted number (or a string) from & to the given bases. |
performance | Returns the time to execute the given function in milliseconds. |
Please open an issue on Github to request a change, report a bug or ask for help about something and i will look into it.
FAQs
A JavaScript library that provides a bunch of useful, optimized and often math-related functions
We found that @zwolfrost/get.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.