1.2.0 • Published 1 year ago

@zwolfrost/get.js v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

get.js

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.

 

Versions

VersionMethods AvailableJSDOC DocumentationMinification
get.jsAll methods:heavy_check_mark::x:
get.min.jsAll methods:x::heavy_check_mark:

 

How to install

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.

 

Changelog and Breaking Changes

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.

  • v1.1.0: Removed "call" method as i didn't feel like it fits in the package theme. Also because it was just the following code: window[name](...args) Added the "root" method.
    • v1.1.1: The imports' usage was finally corrected and the type of the package is specified in package.json (module).
  • v1.2.0: Added "prime_factors" and "extracted_root" methods.

 

How to use

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...

 

Object Methods

Instructions on parameters and details can be found in the JSDOC comments

MethodDescription
intervalsReturns an array that contains the intervalling numbers between the two given numbers (or arrays).
patternReturns an array made up of the given length and number pattern.
uniqueReturns an array made up of unique numbers (that never repeat) from the given one.
decimalsReturns the number of decimals in the given number.
fractionReturns a fraction calculated from the given decimal number. Also works with repeating decimals, if specified.
randomReturns a random number between the two given numbers (inclusive).
normalizedReturns a normalized version of the given string (latin letters only).
timeReturns the current time of the day.
GCDReturns the greatest common divisor between two given numbers.
LCMReturns the least common multiple between two given numbers.
prime_factorsReturns an array that contains the prime numbers that multiply together to make the original number.
extracted_rootReturns an array that contains the extracted number and the one left in the root.
rootReturns the result of a root with the given number and index.
baseReturns a converted number (or a string) from & to the given bases.
performanceReturns the time to execute the given function in milliseconds.

 

Found a bug and/or need help?

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.