@opndev/util

Utility functions for OPN Development

Usage no npm install needed!

<script type="module">
  import opndevUtil from 'https://cdn.skypack.dev/@opndev/util';
</script>

README

Welcome to @opndev/util

This is a utility function package that tries to solve issues by keeping things DRY. It is an ESM package.

Exports

This module exports two functions:

  • any(needle, haystack)
  • defined(something)

import { any, defined } from '@opndev/util'

let foo;
if (defined(foo)) {
  // do things
}

if (any('bar', ['foo', 'bar', 'baz'])) {
  // do things
}

Development

Try to keep functions small and try not to depend on any outside functions. We aim to keep the dependency graph as small as possible. The use of esm is welcomed and writing tests is encouraged.

eslint

The ES Linting profile is flexible and does not try to enforce much. There is more than one way to do it: TIMTOWTDI

Try to stay constistent, but forcing a programming style upon others is bad.

gitignore

Please educate yourself and use a global gitignore file. Somes files will always be there. I'm looking at you node_modules.

The lockfiles

You'll also see that package-lock.json and/or yarn.lock is ignored. I strongly believe that pinning packages lead to bit rot, as you never update packages. When a downstream module breaks its API you should know and update your code accordingly. The same goes for possible upstream modules. If you want a specific version, pin it to that version, otherwise use the latest and greatest when possible.

Code of conduct

There is none, stay human, communicate and accept that some people have different opinions.

Pull requests

I'm happy to accept pull requests, just make sure your change has tests. Add a good commit message and commit with a sign-off git commit -s.

A good commit message isn't just issue(feat): added foo to bar but also explain the why in the commit.