@kraftvaerk/lota-js

1.0.0-alpha.0 • Public • Published

lota-js

Build Status npm Version npm Downloads Dependency Status devDependency Status

All code is vanilla JS, library agnostic and consist mostly of helper methods that aren't directly related with the DOM, the purpose of this library is to provide modular solutions for common JS problems in kraftvaerk.

Main goals

  • increase code reuse;
  • be easy to debug;
  • be easy to maintain;
  • follow best practices;
  • be compatible with other frameworks;
  • be modular;

Installation

npm i @kraftvaerk/lota-js --save

Contents

Another Lodash?

No. The goal is to provide frontend developers in Kraftvaerk with a number of useful and small JavaScript codes, not just functions, but also modules and classes. Think of it as a mini version of npm suitable for tiny packages.

What shouldn't be here

  • UI components;
  • CSS selector engine;
  • Event system - pub/sub;
  • Template engine;
  • Anything that isn't generic enough;
  • Anything that could be a separate library and/or isn't a modular utility...

Submitting New Modules

Unable to find one suitable? Fork it on GitHub, add the module and submit a pull request.


Back to top

UUID

Generates a UUID in a browser. Use crypto API to generate a UUID, compliant with RFC4122 version 4.

const UUID = () =>
  ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
    (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
  );
Examples
import UUID from '@kraftvaerk/lota-js/uuid';

UUID(); // -> 0e3b84af-f911-4a55-b78a-cedf6f0bd815

License

MIT © Kraftvaerk

Package Sidebar

Install

npm i @kraftvaerk/lota-js

Weekly Downloads

10

Version

1.0.0-alpha.0

License

MIT

Unpacked Size

20.8 kB

Total Files

26

Last publish

Collaborators

  • flowntest
  • mi2oon