npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cerceis-lib

v2.4.5

Published

Contains list of quality of life functions that is written in TypeScript and es6

Downloads

95

Readme

Cerceis-Library (known as CLIB).

A Quality of life library

  • Contains list of quality of life functions that is written in TypeScript and es6.
  • Module
  • Author: Cerceis

Installation

npm i cerceis-lib@latest

Usage

*Recommended

import { Generate } from "cerceis-lib";
const id = Generate.objectId();

or

const { Generate } = require("cerceis-lib");
const id = Generate.objectId();

List of functions

*Documentation written as JSDoc. Most of the IDE should recognize if you hover above the function.

To make things more organized, functions are separated into their respective parent, simply import the parent to use them.

Catalog still in progress!

  • Constant: database of various category.
    • gemStones: List of Gem stones name.
    • colors: List of Color's name.
  • Delay: Quick async/await wrapper for delay. ex) await Delay(100).
  • FromArray: Collection of array methods.
    • getRandom: Get random element from an array.
    • getLargest: Get largest element from an array.
    • getSmallest: Get smaller element from an array.
    • getIntersect: Get intersection of two arrays.
    • shuffle: Shuffle array.
    • thanosSnap: Randomly remove half of the element.
    • toObject: Convert array into object.
    • log: A wrapper to console log an array, can take specified index range to print specific range, useful when logging large dataset.
    • includeAll: Compare 2 arrays and return true if all elements are included in each other.
    • isEqual: Compare 2 array, strictly typed, only works with primitives elements.
  • FromNum: Collection of Number methods.
    • roll: Roll percentage. ex) roll(60), 60% will return true.
    • diceRoll: Typical TRPG dice roll. ex) FromNum.diceRoll(3).D(20) = Roll 3 D20 Dice.
    • minMaxScale: Scale number down to 0 ~ 1.
    • unminMaxScale: Revert back to original value.
    • sum: Literally Sum up a list of numbers.
    • softMax: Converts a vector of K real numbers into a probability distribution of K possible outcomes.
    • mean: Return the mean of an list of numbers.
    • toRomanNumeral: Convert numeric values into Roman Numeral string.
    • sigmoid: A sigmoid function is a bounded, differentiable, real function that is defined for all real input values and has a non-negative derivative at each point and exactly one inflection point.
    • relu: ReLU (Rectified Linear Unit function)
    • softPlus: Soft Plus function
    • toNearest: Round number to nearest specified number.
    • toShortReadable: Convert number into short readable string. Ex) 1000 -> 1k, 1,500,000 -> 1.5m
    • stdDiv: Return the standard diviation of the given list.
  • FromObject: Collection of Object methods.
    • ObjectToArray: Convert object into Array.
    • flatten: Flatten nested object.
    • getDeepest: Get deepest entries of a nexted object.
    • sumAll: Sum all the value in an object.
    • min: Find the min value in an object.
    • max: Find the max value in an object.
  • FromString: Collection of String methods.
    • copyToClipboard: Copy string to clipboard.
    • replaceFirst: Replace first N number of letter with desired string.
    • replaceLast: Replace last N number of letter with desired string.
    • parseCookies: Parse http cookies into object.
    • deepClean: Purify string, leaving only 0-9 a-z A-Z.
    • count: Count the number of occurrences of the disired word/letter.
  • FromTime: Collection of time methods.
    • jpnDayMap: Not a function. Map value of int to jpn day label
    • format: Format date object into "YYYY-MM-DD HH:mm:ss".
    • toMs: Convert time to ms.
    • toSeconds: Convert time to seconds.
    • toMinutes: Convert time to minutes.
    • toHours: Convert time to hours.
    • toDateTimeShortLocale: Convert time to short human readable date string.
  • FromVector: Vector manipulation.
    • create: Create a vector object.
      • add
      • limit
      • div
      • mult
      • heading
      • sub
      • setMag
      • magSq
      • mag
      • normalize
      • copy
      • dist
      • toVector2
      • toVector3
  • Gacha: Gacha system.
  • Generate: Collection of data generation methods.
    • alphanum: Generate Alphanumeric value.
    • objectId: Generate objectId.
    • int: Generate Integer.
    • random: Generate random number of given range.
    • array: Array of selected element type.
    • alphabate: Generate alphabate.
    • currentDate: Current date "YYYY-MM-DD".
    • currentTime: Current time "HH:mm:ss".
    • currentDateTime: Current date time "YYYY-MM-DD HH:mm:ss".
    • listOfDateOfDays: Generates and return list of date of specified day.
  • Is: Type check.
  • KMeans: Simplified K-means clustering method.
  • Logger: Coloful and advance console.log() wrapper.
  • Obfuscator: Obfuscate string.
  • Sha256: Sha256 algorithm.
  • Validator: Form validation (in-progress)

Versions:

|Version|Date|Description| |--|--|--| |2.4.1|2023-4-7| Added FromVector, multiple functions in FromArray. |2.2.3|2023-1-11| Added FromNum.toShortReadable. |2.2.2|2023-1-6| Added Constant. |2.2.0|2023-1-5| Added some more functions, and mainly new "FromVector" that can do various vector manipulation. |2.1.0|2022-10-5| Added multiple mathematical functions and fixed memory leak on Delay on some browser. |2.0.1|2022-8-16| Major update, structure changed and added lot's of unfction. |1.5.70|2022-8-9| Added FromObject, Moved ArrayToObject to FromArray, and ObjectToArray to FromObject. |1.5.62|2022-6-9| Added Num |1.5.30|2022-3-14| Added "Is", a function set to check various type. |1.5.24|2022-3-08| Added Prob and fixed various bugs. |1.5|2022-2-16| Added Delay & various fixes. Now supports both CJS and MJS. |1.3|2021-12-28|Updated documentation, Added JSDoc, ShuffleArray. Merged GenerateObjectId, Array, RandomInt, Alphanum into Generate. Merged GetLargest, GetRandomElement, GetSmallest, Intersect into GetArray| |1.2|2021-12-23|Added TomeConverter, KMeans StringPadding| |1.1|2021-12-17|Added Logger, CopyToClipboard, several readme.md.|

FAQ

  • There is an old version of cerceisLib, what are the difference ?
    There's one written 2 years ago, althought it still can be used, but it's not recommended. I will be gradually migrating most of the functions to this newer version.