npm.io
1.2.2 • Published 1 month ago

@editorjs/helpers

Licence
MIT
Version
1.2.2
Deps
1
Size
120 kB
Vulns
0
Weekly
0
Stars
5

@editorjs/helpers

Utils useful for Editor.js tools development

Installation

  npm install @editorjs/helpers

Function list

  • EventsDispatcher - Provides methods for working with Event Bus:
  • Listeners - allListeners - listeners store
  • beautifyShortcut - Make shortcut command more human-readable
  • bem - Utility function that allows to construct class names from block and element names
  • cacheable - Decorator which provides ability to cache method or accessor result
  • capitalize - Capitalizes first letter of the string
  • copyTextToClipboard - Copies passed text to the clipboard
  • debounce - Debouncing method
  • deepMerge - Merge two objects recursively
  • delay - Delays method execution
  • deprecationAssert - Common method for printing a warning about the usage of deprecated property or method.
  • isEmpty - True if passed variable is null/undefined/''/{}
  • notEmpty - True if passed variable is not null/undefined/''/{}
  • equals - Compares two values with unknown type
  • generateId - Returns random generated identifier
  • getValidUrl - Returns valid URL. If it is going outside and valid, it returns itself
  • isPrintableKey - Returns true if passed key code is printable (a-Z, 0-9, etc) character.
  • PromiseQueue - Class allows to make a queue of async jobs and wait until they all will be finished one by one
  • throttle - Returns a function, that, when invoked, will only be triggered at most once during a given window of time.
  • prepare - If library is needed, but it is not initialized yet, this function will initialize it
  • show - Shows tooltip on element with passed HTML content
  • hide - Hides tooltip
  • onHover - Binds 'mouseenter' and 'mouseleave' events that shows/hides the Tooltip
  • destroy - Release the library
  • isBoolean - Checks if passed argument is boolean
  • isClass - Check if passed function is a class
  • isFunction - Check if passed variable is a function
  • isNumber - Checks if passed argument is number
  • isObject - Checks if passed argument is an object
  • isPromise - Check if passed object is a Promise
  • isString - Checks if passed argument is a string
  • isUndefined - Checks if passed argument is undefined
  • typeOf - Return string representation of the object type
  • getUserOS - Returns object with os name as key and boolean as value. Shows current user OS

About CodeX

CodeX is a team of digital specialists around the world interested in building high-quality open source products on a global market. We are open for young people who want to constantly improve their skills and grow professionally with experiments in cutting-edge technologies.

Join Twitter Instagram
codex.so codex.so/join @codex_team @codex_team