Skip to content
Ω Meta-package including all the libs I always need (lodash, pify, etc)
JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
lib
scripts
.eslintignore
.eslintrc.js
.gitignore
.huskyrc.js
.lintstagedrc.js
.prettierrc.js
.stylelintrc.js
LICENSE
README.md
babel.config.js
jest.config.js
package.json
yarn.lock

README.md

Ω Golgoth

Meta-package including all the libs I always need (lodash, pify, etc)

When building project in JavaScript, I often end up installing the same dependencies over and over again. This meta-package is a prototyping shortcut for me, to install them all in one go.

Libraries included

Name Description
chalk Pretty colors in terminal output. Default colors updated to match my colorscheme.
dayjs Easy date parsing and comparing
got HTTP requests made easy
lodash JavaScript utility belt
pAll, pMap and pMapSeries Iterate over async methods
pify Convert those pesky callbacks into Promises
query-string Parse query strings
time-span Simplified timers

Usage

Use the flavor your prefer:

// Load everything and then use what you need
import golgoth from 'golgoth';
golgoth.pify();

// import only what you need
import { pAll, pMap } from 'golgoth';

Additions

_.flatten() and _.unflatten() for objects

Takes any nested object and flatten its keys, or revert it

const data = {
  foo: {
    bar: ['baz', 'quxx'],
  },
};
const flatData = _.flatten(data);
console.info(flatData);
// {
//   'foo.bar.0': 'baz',
//   'foo.bar.1': 'quxx'
// }
console.info(_.unflatten(flatData));
// {
//  foo: {
//    bar: ['baz', 'quxx']
//  }
// }

spinner(max)

Creates a spinner for displaying progress of a task. Uses ora internally.

const items = ['foo', 'bar', 'baz'];
const spinner = golgoth.spinner(42);
_.each(items, item => {
  spinner.tick(item);
});
spinner.succeed('All items scanned');
spinner.fail('Error while scanning items');

Notes

lodash is available either as lodash or _.

You can’t perform that action at this time.