Generic badge Maintenance Maintaner Website shields.io made-with-Markdown made-for-VSCode GitHub license Profile views GitHub contributors GitHub issues
GitHub forks GitHub stars GitHub watchers GitHub followers

OOI

JavaScript Utility & Tools Library


Explore Full Utils List

Home Report Bug Request Feature

⏹️ Features

  • Common JavaScript Utilities. ooi provides some useful functions and classes to make some specific operations more reusable. Working with objects, arrays, collections, convertation, events, formatting, meta-data and types.
  • Node.js Tools. Some useful methods to simplify certain node.js operations.
  • DOM Utilities & Tools. Get, create and modify DOM elements, working with DOM-events and so on.
  • Polyfills. Contains some useful polyfills.

⏹️ Installation

Installation as local package:

npm i --save ooi;

Using the Hole Library:

import ooi from "ooi";

let arr = [1, 2, 3];

ooi.append(arr, 4, 5, 6);

[1, 2, 3, 4, 5, 6].forEach(num => {
  console.log(num);
});

console.log(arr);

⏹️Import ooi-modules by .ooi text file

File util.ooi:

each
extend
flatten
class-meta
plural
isArray: $isarray
sse: ./util/sse.js

Install plugin esbuild-import-plugin:

npm i --save esbuild-import-plugin;

Plug it:

const importPlugin = require("esbuild-import-plugin");

esbuild
  .build({
    entryPoints: ["./src/index.js"],
    bundle: true,
    outfile: "./dist/app/app.js",
    loader: {
      ".js": "jsx"
    },
    sourcemap: true,
    target: ["chrome58", "firefox57", "safari11", "edge16"],
    define: {
      "process.env.NODE_ENV": '"development"'
    },
    plugins: [
      // Here!
      importPlugin
    ]
  })
  .then(() => console.log("Builded!"))
  .catch(err => console.log(err));

Now you can import file util.ooi from esbuild module:

import util from "./util.ooi";

util.each([1, 2, 3], (n, i) => console.log(n, i));

⏹️ CLI

Install ooi as CLI:

sudo npm install --global ooi;

Compile library for client:

ooi compile
  -s objects collections
  -t fn objects
  -min
  -o assets/js/lib/ooi.min.js;

Pack ooi as JS-module:

cli pack
  -s objects collections
  -t fn objects
  -o src/lib/ooi.js

⏹️ Testing

Test all utilities:

npm test;