Socket
Socket
Sign inDemoInstall

docvy-utils

Package Overview
Dependencies
5
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    docvy-utils

general-purpose docvy utilities


Version published
Weekly downloads
1
decreased by-75%
Maintainers
2
Install size
963 kB
Created
Weekly downloads
 

Readme

Source

docvy-utils

node npm Travis Gemnasium Coveralls

installation:

⇒ npm install docvy-utils

the utilities:

var utils = require("docvy-utils");

The exported module object has all the properties from the built-in util module i.e. require("util") is cloned to the above export module object.

utils.defineCallback([callback])

Always returns a function that can be used in place of a callback, if none has been passed in your function. This is a convenience function that avoids the need to keep checking if a callback was passed before calling it, in program logic.

  • callback (Function):
    • you would normally pass the parameter suspected to be the callback.
    • if it is not a function, a new function will returned instead.

utils.defineError(code, message)

Generates a new Error class that can be used to instantiate a new error.

  • code (String): error code e.g. "ECODE"
  • message (String): error message e.g. "error message due to null argument"

utils.errors

This holds a reference to the common-errors module.

utils.getPath(pathname)

Returns application-specific paths. These paths are absolute.

  • pathname (String):
    • can be any of:
      • app.home: application user/home directory
      • app.cache: directory for all application caches
      • app.cache.plugins: directory for plugin handler's cache
      • app.logs: directory for logs
      • app.plugins: directory for user-installed plugins
    • if it does not match any of the above, null is returned.

Note: The target path is created if not yet existent.

utils.loadConfig(abspath)

Loads a configuration file at the absolute path abspath. Note: an error is thrown if the path is broken or if the file pointed by the path does not have valid JSON.

An immutable object is returned.

license:

The MIT License (MIT)

Copyright (c) 2015 Forfuture we@forfuture.co.ke
Copyright (c) 2015 GochoMugo mugo@forfuture.co.ke

Keywords

FAQs

Last updated on 10 Aug 2015

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