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

cmfcucai

v1.2.1

Published

hmmm .....

Downloads

55

Readme

Intro

hmmm .....

Setup

$ npm install cmfcucai@latest

Import


import { 
    CommonFunc,
    CommonDate,
    CommonFile 
    } from 'cmfcucai';

CommonFunc

deleteCookie,
delAllCookie,
getcookie,
setCookie
setSelectionRange (input , selectionStart: number, selectionEnd: number)
        => select range of input from "selectionStart" to selectionEnd

checkDouble (valueCheck: string)
        => check vallueString is Double

formatDecimal,
compare2Object,
getByteLength(value: string) : number
        => return byte lengh of value

UUIDV4
        => generate uuid with pattern "'xxxVxxxxx-xxOxx-Lxxx-Axxx-xxxVxxxxxxxxLx'"

smallUUID
        => generate uuid with pattern "'xxxvxxxlxx'"

emailValidate(email: string) : boolean
        => check email vailid or not

createUrlQuery(data: Object)
        => convert Object to Param URL EXP {a : 1, b : 2} = > ?a=1&b=2

replaceAll(value: string, search: string, replaceWith: string) 
        => replace all search String to "replaceWith"
OTP(secret_key: string, otp_valid_for_secs = 30, date = new Date(), lengthToken = 6)
        => generate One Time Password from serect key with each "otp_valid_for_secs" seconds

checkOTP(otp: any, secret_key: any, otp_valid_for_secs = 30, date = new Date(), lengthToken = 6)
        => check OTP generate from serect key by each "otp_valid_for_secs" second

extractUniqueKey(data : object[],key : string,join = null)
        => input : data = [
                {a:1 , b:2 , c: 3},
                {a:1 , b:2 , c: 3},
                ...
        ]
        key = 'c'
        return [3,3]
        if join is not null 
                join = ','
                return '3,3'
uniqueStrArr(data : string[])
        => input = ['1','2','3','1'] return ['1','2','3']

CommonDate


getDateString,
isLeapYear(dateOrString : Date)
        => check is leap year
           if dateOrString is null date return is current date

getDaysInMonth(dateOrString : any)
        => return all day in dateOrString
           if dateOrString is null date return is current date

countDayNotSunday(dateStart:Date, dateEnd:Date)
        => return count day from "dateStart" to "dateEnd" with not sunday count

addMonths(dateOrString : any,monthAdd : number,toString = false) 
        => add month from param "monthAdd"
           if dateOrString is null date return is current date
           if toString = true will return Date else return string with pattern "YYYY/MM/DD"

formatValueChange,
roundDate(_date : any, end = false)
        => round date to start of date
           if _date is null date return is current date
           if end == true will return round end of date
getDayBetween2Date,
isDateWithFormat(value: string, pattern = "YYYY/MM/DD"): boolean
        => check value is date with pattern default is "YYYY/MM/DD"

getUTCDate
        => return {year,month,day,hour,minute,second} with UTC Time Zone

extracDateStr(value)
        will return below
        => exp : value = "01/12" = {
                date : true,
                format : 'DD/MM',
                year:'',
                month:'01',
                day:'12',
                hour:'',
                minute:'',
                second:''
        }
dateStrFormat(date: string, pattern = "mm/dd") 
        will return date format with pattern;
        => date = "20221212" return "12/12";

shuffle(obj : Object[])
        return shuffle element in obj
        
groupBy(data : object[],key : string)
        return group element by key

extractUniqueKey(data : object[],key : string,join? : string)
        return list data unique by key
        if join has value , it will return join string with list unique by key

CommonFile

Module common for File.

arrayDataToTxt, -> export file text
base64ToBlob,
dataToCSV -> export file CSV
svgToFile, -> SVGElement to file png
svgToPng, -> SVGElement to file svg
arrayDataToTxt => export array data to file txt
        parameter : (_arrayData, fileName = "text.txt") 
        _arrayData exp : ["row1","row2",...]
        fileName default is "text.txt"

base64ToBlob => convert base64 string to blob

dataToCSV => export object data to file csv
        parameter : (dataListObj,options,fileName = 'myCSV.csv') 
        options exp : [{headerName : '' , columnName : ''}]
        fileName default is "myCSV.csv"

svgToPng => export SVGElement to file png
        (svg: SVGElement, fileName = "unamed.png", callBack = () => { })
        svg = document.querySelector("svg") or  @ViewChild("", { static true }) svg!: HTMLElement
        fileName default is "unamed.png"

svgToFile => export SVGElement to file svg
        (svg: any, fileName = "unamed.svg", callBack = () => { })
        svg = document.querySelector("svg") or  @ViewChild("", { static true }) svg!: HTMLElement
        fileName default is "unamed.svg"


sliceFile(file: File | any , splitUnit: number = 10)
        =>
        slice file to multiple package with 10mb by default
        return Array of {
                         uuid: string;
                         originalFileName: string;
                         fileSize: number;
                         fileB64: string;
                         fileSlice : Blob;
                        }
file2Base64(file: Blob | File)
        => convert file to base64 string

update late

Sometime can help you, maybe