New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

yorker

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yorker

Nice development logs

latest
Source
npmnpm
Version
0.1.6
Version published
Maintainers
1
Created
Source

Yorker

GitHub license npm version Build Status

NodeJS library for nice & easy console logs.

Quick Start

Install using yarn or npm.

$ yarn add yorker
$ npm install yorker --save

Import in one of your js, ts or vue files and start using it.

import { yorker } from 'yorker';

const say = yorker.see('something');
say('something');

By default it will be switched off for production enviroment NODE_ENV="production".

Advanced Setup

Create a file in your project to have a singlethon instance of the logger. To instantiate the Yorker class you need two parameters to set up: Theme and the flag enabled.

import { Yorker, NYPDTheme } from 'yorker';

const theme = new NYPDTheme();
const enabled = process.env.NODE_ENV !== 'production';
export const newYorker = new Yorker(theme, enabled);

A new custom theme can be created by implementing the ITheme interface.

API

It's very easy and has only one method see(msg) that returns a function say(msg, error?).

const say = yorker.see('something');
say('everything is Okay');
say('there is an error', new Error('smth'));

Example

function startMongo(config: { url: string }) {
    const say = yorker.see(`Connecting to mongo: "${config.url}"`);
    const client = new MongoClient(config.url, { raw: true, useNewUrlParser: true });
    client.connect((err, client) => {
        if (err) {
            say('Error while connecting to mongo.', err);
            return process.exit(1);
        }
        say('Connection to mongo succeeded.');
    });
}

FAQs

Package last updated on 18 Feb 2019

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