Utility helpers for okiba.js

Usage no npm install needed!

<script type="module">
  import okibaFunctions from 'https://cdn.skypack.dev/@okiba/functions';


Okiba / functions

A collection of contextless utility functions



npm i --save @okiba/functions

Or import it directly in the browser

<script type="module" src="https://unpkg.com/@okiba/functions/index.js"></script>


import functions from '@okiba/functions'

Untranspiled code 🛑

Okiba Core packages are not transpiled, so don't forget to transpile them with your favourite bundler. For example, using Babel with Webpack, you should prevent imports from okiba to be excluded from transpilation, like follows:

  test: /\.js$/,
  exclude: /node_modules\/(?!(@okiba)\/).*/,
  use: {
    loader: 'babel-loader',
    options: {
      presets: ['@babel/preset-env']

debounce(callback, latency, timer)

Callback debounce helper. Returns a debounced version of provided callback

import {debounce} from '@okiba/functions'

const onResize = () => console.log('window resized')
window.addEventListener('resize', debounce(onResize, 300))


+ callback: function

The callback to be debounced

+ latency: Number

The debounce delay time

+ timer: Number

The timer id


function The debounced version of original callback