New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

xtitan_utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xtitan_utils

XTitan_Utils is a JavaScript library for quick functions.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Utils

XTitan_Utils is a JavaScript library for quick functions.

Features

  • Support Chrome, Safary, Opera browsers
  • Type kind parameters with types
  • The ability to use the function Random and UUID functionals
  • Mixin objects
  • Advanced Math functions

Usage

Adding script an core html file.

<script src="https://x-titan.github.io/utils/index.js" type="module" defer></script>

Import all functions

import * from "https://x-titan.github.io/utils/index.js"

Type definition

Examples

Type definition

Function is

is.str(value)       // String
is.num(value)       // Number
is.obj(value)       // Object
is.bool(value)      // Boolean
is.symbol(value)    // Symbol
is.null(value)      // null
is.defined(value)   // any
is.undefined(value) // undefined
// And more usability methods of type functions

Using is for kind type arguments.

import { is } from "https://x-titan.github.io/utils/index.js"

function fizz (a) {
    if(is.str(a)){
        // typeof a === "string"
    }

    if(is.num(a)){
        // typeof a === "number"
    }
}

Math

import { radianToDegree, degreeToRadian } from "https://x-titan.github.io/utils/index.js"

var angle = radianToDegree(Math.PI / 2) // return: 90
var radian = degreeToRadian(180)        // return: 3.14 (Math.PI)

Clamp

import { clamp, map } from "https://x-titan.github.io/utils/index.js"

var result_1 = clamp(value, min, max)
var result_2 = map(value, fromLow, fromHigh, toLow, toHigh)

Greatest common divisor

import { gcd } from "https://x-titan.github.io/utils/index.js"

var result_1 = gcd(a,b)

Random

import "https://x-titan.github.io/utils/index.js"

var result = Math.random(min, max)
var int = Math.randInt(min, max)

Create new random function

var rand = Math.newRandom(seed)

rand()
rand(min)
rand(min, max)

Object mixins

import { mixin, extend } from "https://x-titan.github.io/utils/index.js"

var obj = mixin(...objects)

var result = extend(obj, ...objects) // result === obj

Mono

import { Mono } from "https://x-titan.github.io/utils/index.js"

class A extends Mono(...objects) {
    constructor(){
        super()
    }
}

class B {
    constructor(){
        Mono.mixin(this)
    }
}

const C = Mono.extend(class C { })

FAQs

Package last updated on 13 Dec 2023

Did you know?

Socket

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.

Install

Related posts