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

oasiscity-nodejs-library

v1.0.5

Published

oasiscity nodejs library

Downloads

183

Readme

READ ME

node version : nodejs version : 18.20.3

Date.js

/**
 * Convert date object to "YYYY-MM-DD HH:MM:SS" format
 * @param {Date} date given date time (YYYY-MM-DD HH:MM:SS)
 * @param {Locale} locale default : "en-US"
 * @param {string} timeZone default : "UTC"
 * @returns {String} formated to "YYYY-MM-DD HH:MM:SS"
 */
function formatDateTime(date, locale = "en-US", timeZone = "UTC")
/**
 * Convert string type datetime to date type datetime
 * @param {string} dateTime given date time (YYYY-MM-DD HH:MM:SS)
 * @param {Locale} locale default : "en-US"
 * @param {string} timeZone default : "UTC"
 * @returns {Date}
 */
function convertDateTime(dateTime, locale = "en-US", timeZone = "UTC")
/**
 * Is date before given date || Is date after today
 * @param {string} givenDateTime given date time (YYYY-MM-DD HH:MM:SS)
 * @param {Locale} locale default : "en-US"
 * @param {string} timeZone default : "UTC"
 * @returns {boolean}
 *
 * Must set time format to 23:59:59 if end date time is end of the day.
 */
function isDateTimeBeforeToday(givenDateTime, locale = "en-US", timeZone = "UTC")
/**
 * Is date after given date
 * @param {string} givenDateTime given date time (YYYY-MM-DD HH:MM:SS)
 * @param {Locale} locale default : "en-US"
 * @param {string} timeZone default : "UTC"
 * @returns {boolean}
 */
function isDateTimeAfterToday(givenDateTime, locale = "en-US", timeZone = "UTC")
/**
 * Is date between two dates
 * @param {string} startDateTime start datetime
 * @param {string} endDateTime end datetime
 * @param {Locale} locale default : "en-US"
 * @param {string} timeZone default : "UTC"
 * @returns {boolean}
 */
function isDateTimeBetween(startDateTime, endDateTime, locale = "en-US", timeZone = "UTC")

deep_copy.js

/**
 * Function for deep copying jsonobject and jsonarray
 * @param {Object} value target
 * @returns {Object}
 */
function deepCopy(value)

isEmpty.js

/**
 * Check variable is empty
 * @param {Object} v target
 * @returns {boolean}
 */
function isEmpty(value)

isNumber.js

/**
 * Validate string value is a number
 * @param {string} value target
 * @returns {boolean}
 */
function isNumberOnlyString(value)
/**
 * Validate value is a number type variable
 * @param {Object} value target
 * @returns {boolean}
 */
function isNumberType(value)

JSON.js

/**
 * Convert querystring to JSON
 * @param {string} queryString
 * @returns {Object}
 */
function queryStringToJson(queryString)
/**
 * Get existence object from the list
 * @param {Object} JSONObject
 * @param {string[]} JSONArray
 * @return {Object}
 * { idx: 1, sid: "9999", username: "sickdog", password: "password", date: "Jan 19, 1984"} ["sid","username"]
 * return { sid: "9999", username: "sickdog" }
 */
function getMapFromList(object, array)

Number.js

/**
 * Return string type value with filling zeros
 * @param {number|string} value number to fill zeros
 * @param {number} digit digits value number between 0~1024 | default 4
 * @returns {String}
 */
function fillZeros(value = 0, digit = 4)
/**
 * Return random number between given number
 * @param {number} start number starts
 * @param {number} end number ends
 * @returns {number}
 */
function getRandomNumberBetween(start, end)
/**
 * Return odds of winning
 * @param {number} percentage number between 0~100 (percentage%100)
 * @returns {boolean}
 */
function lottery(percentage)
/**
 * Return odds of winning out of 1/denominator
 * @param {number} denominator number between 0~isSafeInteger
 * @returns {boolean}
 */
function lotteryDigit(denominator)

verify_key_value.js

/**
 * Return key values which exist
 * @param {Object} value target
 * @param {string[]} items search keys
 * @returns {Object}
 * ```js
 * {
 *   guest: '',
 *   start_ip: '192.168.0.0',
 *   end_ip: '192.168.0.255',
 *   cidr: '192.168.1.0/24',
 *   ss: ' ',
 *   enabled: false,
 *   flag: '',
 *   description: 'black list target'
 * }
 * { start_ip: '192.168.0.0', end_ip: '192.168.0.255' }
 * ```
 */
function verifyKeyValue(target, items)
/**
 * Return key value existence result
 * @param {Object} value target
 * @param {string[]} items search keys
 * @returns {Object{string[],string[]}}
 */
function verifyEveryKeyValueExistResult(target, items)
/**
 * Return key value which exist
 * @param {Object} value target
 * @param {string[]} items search keys
 * @returns {Object}
 */
function returnKeyValueExist(target, items)

oasiscity.js