@hyunbinseo/tools
v0.1.0
Published
Fully typed JavaScript utilities with ESM and CJS support
Downloads
11
Readme
Tools by Hyunbin
Fully typed JavaScript utilities with ESM and CJS support. Module List
Usage
Node.js
npm i @hyunbinseo/tools
pnpm i @hyunbinseo/tools
// Reference the following section for the full module list.
import { dateToSafeISOString, generatePINString } from '@hyunbinseo/tools';
Browser
// Reference the following section for the full module list.
// The major version number MUST be specified in the pathname.
import {} from 'https://cdn.jsdelivr.net/npm/@hyunbinseo/[email protected]/dist/index.js';
Modules
Date to Safe ISO String
Timestamp string that can be safely used in filename, directory name, etc.
dateToSafeISOString(); // Uses the current time (e.g. 20240402T020408.248Z)
dateToSafeIsoString(new Date('2024-05-26T00:00+09:00')); // 20240525T150000.000Z
// The outputted string CANNOT be used in JavaScript.
new Date('20240525T150000.000Z'); // Invalid Date
Generate PIN String
Truly random number string using the Crypto.getRandomValues()
method.
generatePINString(); // 270136
generatePinString(8); // 39534786