Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wootils

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wootils

A set of Javascript utilities for building Node and browser apps.

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
138
increased by81.58%
Maintainers
1
Weekly downloads
 
Created
Source

Wootils

A set of Javascript utilities for building Node and browser apps.

Motivation/Introduction

The idea was to take all those small thing I'm always rewriting on every project and move them to a single package so I can not only stop copying & pasting them all over the place but also maintain them all together.

There are two rules I followed when I had to decide what to put and what to keep somewhere else:

  1. The utility needs to fit on a single file.
  2. It shouldn't include any specific business logic from any other project.

Information

--
Packagewootils
DescriptionA set of Javascript utilities for building Node and browser apps.
Node Version>= v6.10.0

Usage

The package is divided on 2 folders:

  • node: Utilities only compatible with Node.
  • shared: Utilities that can work on both browser and Node.

Yes, when the time comes, it will have a browser folder too.

Node utilities

Two notes about the Node utilities:

  1. I'm a big fan of Jimple, so all the files not only export the utility but also a service provider or a "servicer provider generator" to register the utility on a Jimple app.
  2. Some of them may depend on the others.
AppConfiguration

This is a service to manage applications configurations. It takes care of loading, activating, switching and merging configuration files.

Read more about AppConfiguration

EnvironmentUtils

A really small service to centralize the place where you read environment variables and check if you are running on development or production.

Read more about EnvironmentUtils

ErrorHandler

Listens for uncaught exceptions and unhandled promises rejections, and logs them out with full detail.

Read more about ErrorHandler

Logger

The name leaves nothing to the imagination. As you may have guessed, this is service for logging messages into the console.

Read more about Logger

packageInfo

A tiny function that reads the contents of the app package.json. This is really useful on an Jimple application where you can register it, because the returned value gets cached and it's available as a service.

Read more about packageInfo

PathUtils

An easy way to manage locations and build paths relative to those locations on a Node app.

Read more about PathUtils

rootRequire

Is basically require but the path is relative to the project root directory.

Read more about rootRequire

Shared utilities

APIClient

A really basic client to work with an API endpoints requests.

Read more about APIClient

deferred

Create a deferred promise using the native Promise object.

Read more about deferred

deferred

A small implementation of a pubsub service for handling events on an app.

Read more about EventsHub

Development

Before doing anything, install the repository hooks:

# You can either use npm or yarn, it doesn't matter
npm run install-hooks

NPM/Yarn Tasks

TaskDescription
npm run install-hooksInstall the GIT repository hooks.
npm testRun the project unit tests.
npm run lintLint the modified files.
npm run lint:fullLint the project code.
npm run docsGenerate the project documentation.
npm run todoList all the pending to-do's.

Testing

I use Jest with Jest-Ex to test the project. The configuration file is on ./.jestrc, the tests and mocks are on ./tests and the script that runs it is on ./utils/scripts/test.

Linting

I use ESlint to validate all our JS code. The configuration file for the project code is on ./.eslintrc and for the tests on ./tests/.eslintrc (which inherits from the one on the root), there's also an ./.eslintignore to ignore some files on the process, and the script that runs it is on ./utils/scripts/lint.

Documentation

I use ESDoc to generate HTML documentation for the project. The configuration file is on ./.esdocrc and the script that runs it is on ./utils/scripts/docs.

To-Dos

I use @todo comments to write all the pending improvements and fixes, and Leasot to generate a report. The script that runs it is on ./utils/scripts/todo.

FAQs

Package last updated on 22 Jan 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc