
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
@sk2you/custom-utils
Advanced tools
This repository contains a collection of useful JavaScript/TypeScript utility functions for common tasks like date formatting, pagination, and number formatting.
# Using npm
npm install @yourpackage/utils
# Using yarn
yarn add @yourpackage/utils
Format UNIX timestamps into readable date strings with customizable options.
getFormattedDate(
UNIX_timestamp: number | string,
types: string[],
symbol = '-',
timeSeparator = ':',
timeFormat = '24',
monthName = false,
includeDay = true
): string
'day', 'date', 'month', 'year', 'hour', 'minute', 'second', 'period')-):)'12' for 12-hour format with am/pm, '24' for 24-hour format (default: '24')false)true)Calculate page count based on pagination parameters.
GetPageCount(pagination: PaginationParams, index: number): number
limit and page propertiesConvert numbers to their word representation with support for both Western and Indian number systems.
numberToWords(num: number, useIndianSystem = false): string
false)Format numbers with Indian numbering system separators.
formatNumberWithIndianSeparators(
num: number | string,
separator = ',',
includeWords = false
): string
,)false)import { getFormattedDate } from '@yourpackage/utils';
// Basic date formatting
const timestamp = 1618990800000; // April 21, 2021
const formattedDate = getFormattedDate(timestamp, ['date', 'month', 'year']);
console.log(formattedDate); // "21-04-2021"
// With month names and custom separator
const prettyDate = getFormattedDate(timestamp, ['date', 'month', 'year'], '/', undefined, undefined, true);
console.log(prettyDate); // "21/Apr/2021"
// With time
const dateTime = getFormattedDate(timestamp, ['date', 'month', 'year', 'hour', 'minute'], '-', ':', '12', true);
console.log(dateTime); // "21-Apr-2021 12:00"
import { GetPageCount } from '@yourpackage/utils';
const pagination = { limit: 10, page: 2 };
const itemIndex = 3;
const pageCount = GetPageCount(pagination, itemIndex);
console.log(pageCount); // 14 (10 + 3 + 1)
import { numberToWords } from '@yourpackage/utils';
// Western system
console.log(numberToWords(123)); // "one hundred twenty-three"
console.log(numberToWords(1000000)); // "one million"
// Indian system
console.log(numberToWords(100000, true)); // "one lakh"
console.log(numberToWords(10000000, true)); // "one crore"
import { formatNumberWithIndianSeparators } from '@yourpackage/utils';
// Basic formatting
console.log(formatNumberWithIndianSeparators(123456)); // "1,23,456"
console.log(formatNumberWithIndianSeparators(10000000)); // "1,00,00,000"
// With Indian number names
console.log(formatNumberWithIndianSeparators(100000, ',', true)); // "1,00,000 (1 lakh)"
console.log(formatNumberWithIndianSeparators(20000000, ',', true)); // "2,00,00,000 (2 crores)"
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A collection of utility functions for TypeScript projects
We found that @sk2you/custom-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.