UNPKG

@supercharge/fs

Version:

Async filesystem methods for Node.js

31 lines (30 loc) 771 B
'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isDate = exports.randomString = void 0; const crypto_1 = __importDefault(require("crypto")); /** * Generates a random string with 32 characters. * * @returns {String} */ function randomString() { return crypto_1.default .randomBytes(256) .toString('hex') .slice(0, 32); } exports.randomString = randomString; /** * Determine whether the given `date` is an instance of `Date`. * * @param {Date} date * * @returns {Boolean} */ function isDate(date) { return date instanceof Date; } exports.isDate = isDate;