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

dd360-utils

v18.1.1

Published

This library is a utils functions

Downloads

1,366

Readme

DD360 Utils frontend

size minzip size version types license pipeline - jobs

This is DD360 library of utils functions based on Typescript.

This project is based IN:

TYPESCRIPT

Installation

 npm i dd360-utils

How to imports?

import { formatCurrency, formatDecimal, unFormatCurrency, getLeftAndTopScreen, getQueryParams } from 'dd360-utils'

const { formatCurrency, formatDecimal, unFormatCurrency, getLeftAndTopScreen, getQueryParams } = require('dd360-utils')

Currency Helpers

Use format currency:

import { formatCurrency, unFormatCurrency, formatDecimal } from 'dd360-utils'

formatCurrency(4000) // return 4,000
unFormatCurrency('4,000') // return 4000
formatDecimal(4000) // return 4,000.00

Use input format currency:

The format and formatCents methods expose a couple internal helper functions.

import { inputCurrency } from 'dd360-utils'

inputCurrency.format('2500') // $2,500.00
inputCurrency.format(200) // $200.00
inputCurrency.format(200, { removeSymbol: true, removeCents: true }) // 200
inputCurrency.formatCents('$2,500.55') // 250055
formatCurrencyInput.formatCents(2) // 200

Processing Helpers

Use getQueryParams

// get queryparams from url
const type = getQueryParams('type')

Use ObjectIsEmpty

import { objectIsEmpty } from 'dd360-utils'

objectIsEmpty({}) // true
objectIsEmpty({ name: 'John' }) // false

Use removeAccents

import { removeAccents } from 'dd360-utils'

removeAccents('ananá') // anana

Maths Helpers (How to use)

import { sum, subtract, multiply } from 'dd360-utils'

sum(4, 4) // 8
subtract(4, 2) // 2
multiply(2, 2) // 4

Storage Helpers (How to use)

LocalStorage Helpers

import { setLocalStorage, getLocalStorage, removeLocalStorage, removeKeysFromLocalStorage, clearLocalStorage } from 'dd360-utils'

setLocalStorage('theme', 'dark')
getLocalStorage('theme') // dark
removeLocalStorage('theme') // delete theme from localStorage
removeKeysFromLocalStorage(['theme', 'access_token', 'etc']) // remove this keys from localStorage
clearLocalStorage() // clear all keys from localStorage

SessionStorage Helpers

import { setSessionStorage, getSessionStorage, removeSessionStorage, removeKeysFromSessionStorage, clearSessionStorage } from 'dd360-utils'

setSessionStorage('theme', 'dark')
getSessionStorage('theme') // dark
removeSessionStorage('theme') // delete theme from sessionStorage
removeKeysFromSessionStorage(['theme', 'access_token', 'etc']) // remove this keys from sessionStorage
clearSessionStorage() // clear all keys from sessionStorage

Form Validations

Use password validations

import { passwordValidations } from 'dd360-utils'

passwordValidations.isValidPasswordlowerUpper('Asd') // true
passwordValidations.isValidPasswordNumbers(4) // true
passwordValidations.isValidPasswordCharacters('$') // true

Other validations

import { isValidEmail, isValidNumberPhone, isValidCURP, isValidRFC, userAgentIsMobile } from 'dd360-utils'

isValidEmail('[email protected]') // true
isValidEmail('correo') // false
isValidNumberPhone(1132678476) // true
isValidNumberPhone(223) // false
isValidCURP(YOUR_CURP) // true or false
isValidRFC(YOUR_RFC) // true or false
userAgentIsMobile() // if its mobile, return true

Date Helpers

Use Name of months

import { getNameMonth } from 'dd360-utils'

getNameMonth(1, 'es') // Enero
getNameMonth(1, 'en') // January

Screen Events Helpers

Use screen events

// get left and top of screen
const { left, top } = getLeftAndTopScreen(event)