Socket
Socket
Sign inDemoInstall

yow

Package Overview
Dependencies
2
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yow

You Only Wish module


Version published
Weekly downloads
59
decreased by-48.7%
Maintainers
1
Install size
78.9 kB
Created
Weekly downloads
 

Readme

Source

Yow

Toolbox for Node. Contains stuff you only wished was there in the first place.

Installation

npm install yow --save

Methods

General Purpose

  • sprintf(args) - Just as you would expect. Uses the npm module 'sprintf-js'.
  • extend(args) - Again, just as you would expect. Uses the npm module 'extend'.

File System

  • mkdir(path) - Creates the directory you specify.
  • mkpath(path) - Creates the directory you specify. It will create multiple directories if they do not exit.
  • fileExists(path) - Nothing fancy, it just returns true/false.
  • readJSON(fileName) - Reads a JSON file and returns the contents.
  • writeJSON(fileName, object) - Writes an object to a JSON file.

Type Checks

  • isType(object, type) - Returns true/false if typeof equals 'type'.
  • isArray(object) - Is object an array?
  • isNumber(object) - Is object a JavaScript Number object?
  • isString(object) - Is object a String object?
  • isDate(object) - Is object a Date object?
  • isFunction(object) - Is object a function object?
  • isObject(object) - Is object an object? BTW null is not an object.
  • isInteger(object) - Is object an integer?
  • isFloat(object) - Is object a float?

Random

  • random() - Returns Math.random().
  • random(integer) - Returns a random number from 0 to the integer specified (exclusive).
  • random(min, max) - Returns a random number from min to max (inclusive).
  • random(array) - Returns a randomly chosen object in the specified array.
  • random(object) - Returns a randomly chosen object property.

Range

  • range(min, max, step) - Returns an range array generated by min, max, and step.

Logging

  • prefixLogs(prefix) - Prefix all logs with the specified prefix. This may be a function or a string expression. Default is the current date/time.
  • redirectLogs(file) - Redirects all logging to the specified file. If not specified, a log file with the current date/time will be created.

Keywords

FAQs

Last updated on 16 Nov 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc