README.md

FRNT-UTILS

Это небольшая библиотека с набором функций, которые я достаточно часто применяю при разработке фротенд-приложений.

Установка

Скопировать файл main.js из директории /src в свой проект.

Functions

mapObj(mapSchema, sourceObj)Object

Maps js object to another object with given mapping schema

generateId()string

Generates random id string

range(start, stop, step)Array

Sequence generator function

getDaysGeneratorForYearMonth()function

Function that returns callback for generating sequence of days for given month and year

shortenStr(lettersAllowed, str)string

Shortens string to given number of letters

debounce(callback, [delay])function

Creates a debounced version of the given callback function that will be called after a specified delay. If the debounced function is called multiple times within the delay period, the callback will only be invoked once, after the delay has passed.

mapObj(mapSchema, sourceObj) ⇒ Object

Maps js object to another object with given mapping schema

Kind: global function
Returns: Object - Mapping resulting object

Param Type Description
mapSchema Object Object that determines relations between source and destination objects in form {‘Destination object key’: ‘Source object key’}
sourceObj Object Object that need to be mapped

generateId() ⇒ string

Generates random id string

Kind: global function
Returns: string - Randomly generated string

range(start, stop, step) ⇒ Array

Sequence generator function

Kind: global function
Returns: Array - Array with sequence elements from start to stop

Param Type Description
start number Start value of the sequence
stop number End value of the sequence
step number Step for sequence elements

getDaysGeneratorForYearMonth() ⇒ function

Function that returns callback for generating sequence of days for given month and year

Kind: global function
Returns: function - Days sequence generator function

shortenStr(lettersAllowed, str) ⇒ string

Shortens string to given number of letters

Kind: global function
Returns: string - Shortened string

Param Type Description
lettersAllowed number Number of letters string must fit to
str string String to be shortened

debounce(callback, [delay]) ⇒ function

Creates a debounced version of the given callback function that will be called after a specified delay. If the debounced function is called multiple times within the delay period, the callback will only be invoked once, after the delay has passed.

Kind: global function
Returns: function - - The debounced version of the callback function.

Param Type Default Description
callback function The callback function to be debounced.
[delay] number 0 The delay in milliseconds before invoking the callback.
Описание

Небольшая библиотека с часто мною используемыми на фронтенде функциями

Конвейеры
0 успешных
0 с ошибкой