Socket
Socket
Sign inDemoInstall

@wixc3/common

Package Overview
Dependencies
Maintainers
65
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/common - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

16

dist/cjs/functions.d.ts

@@ -16,7 +16,13 @@ /**

* Ensures `func` will be called with at least `wait` ms between runs.
* For @example, if `func` is called 3 times in a row:
* `func(1); func(2); func(3);`
* it will wait `wait` ms between each run:
* `func(1); await sleep(wait); func(2); await sleep(wait); func(3);`
*
* @example
* ```ts
* // if `func` is called 3 times in a row:
* func(1); func(2); func(3);
* // it will wait `wait` ms between each run:
* func(1);
* await sleep(wait);
* func(2);
* await sleep(wait);
* func(3);`
* ```
* This is not throttling (!) since eventually all calls will be ran,

@@ -23,0 +29,0 @@ * while in throttling the calls in the "wait" period are skipped.

@@ -34,7 +34,13 @@ "use strict";

* Ensures `func` will be called with at least `wait` ms between runs.
* For @example, if `func` is called 3 times in a row:
* `func(1); func(2); func(3);`
* it will wait `wait` ms between each run:
* `func(1); await sleep(wait); func(2); await sleep(wait); func(3);`
*
* @example
* ```ts
* // if `func` is called 3 times in a row:
* func(1); func(2); func(3);
* // it will wait `wait` ms between each run:
* func(1);
* await sleep(wait);
* func(2);
* await sleep(wait);
* func(3);`
* ```
* This is not throttling (!) since eventually all calls will be ran,

@@ -41,0 +47,0 @@ * while in throttling the calls in the "wait" period are skipped.

@@ -16,7 +16,13 @@ /**

* Ensures `func` will be called with at least `wait` ms between runs.
* For @example, if `func` is called 3 times in a row:
* `func(1); func(2); func(3);`
* it will wait `wait` ms between each run:
* `func(1); await sleep(wait); func(2); await sleep(wait); func(3);`
*
* @example
* ```ts
* // if `func` is called 3 times in a row:
* func(1); func(2); func(3);
* // it will wait `wait` ms between each run:
* func(1);
* await sleep(wait);
* func(2);
* await sleep(wait);
* func(3);`
* ```
* This is not throttling (!) since eventually all calls will be ran,

@@ -23,0 +29,0 @@ * while in throttling the calls in the "wait" period are skipped.

@@ -28,7 +28,13 @@ import { sleep } from 'promise-assist';

* Ensures `func` will be called with at least `wait` ms between runs.
* For @example, if `func` is called 3 times in a row:
* `func(1); func(2); func(3);`
* it will wait `wait` ms between each run:
* `func(1); await sleep(wait); func(2); await sleep(wait); func(3);`
*
* @example
* ```ts
* // if `func` is called 3 times in a row:
* func(1); func(2); func(3);
* // it will wait `wait` ms between each run:
* func(1);
* await sleep(wait);
* func(2);
* await sleep(wait);
* func(3);`
* ```
* This is not throttling (!) since eventually all calls will be ran,

@@ -35,0 +41,0 @@ * while in throttling the calls in the "wait" period are skipped.

{
"name": "@wixc3/common",
"version": "4.0.1",
"version": "5.0.0",
"description": "Common utils, usable in all environments",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -27,90 +27,93 @@ [![npm version](https://badge.fury.io/js/@wixc3%2Fcommon.svg)](https://badge.fury.io/js/@wixc3%2Fcommon)

| Function | Description |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [assertIsString(value, errorMessage)](https://wixplosives.github.io/core3-utils/common.assertisstring) | Throws if value is not a string |
| [at(iterable, index)](https://wixplosives.github.io/core3-utils/common.at) | Finds element by index, including negative index |
| [awaitRecord(obj)](https://wixplosives.github.io/core3-utils/common.awaitrecord) | Awaits a record of promises, and returns a record of their results. |
| [capitalizeFirstLetter(val)](https://wixplosives.github.io/core3-utils/common.capitalizefirstletter) | Capitalize the first letter of a string |
| [chain(value)](https://wixplosives.github.io/core3-utils/common.chain) | Chain iterable operations, each acting on the output of the previous step |
| [chain(value)](https://wixplosives.github.io/core3-utils/common.chain_1) | Chain iterable operations, each acting on the output of the previous step |
| [clamp(value, min, max)](https://wixplosives.github.io/core3-utils/common.clamp) | |
| [concat(iterables)](https://wixplosives.github.io/core3-utils/common.concat) | |
| [createRandomIntWithSeed(seed)](https://wixplosives.github.io/core3-utils/common.createrandomintwithseed) | |
| [defaults(\_source, \_defaultValues, deep, shouldUseDefault)](https://wixplosives.github.io/core3-utils/common.defaults) | Returns an object where missing keys and values/keys that satisfy shouldUseDefault to the value in shouldUseDefault. |
| [delayed(fn, wait)](https://wixplosives.github.io/core3-utils/common.delayed) | <p>Ensures <code>func</code> will be called with at least <code>wait</code> ms between runs. For @<!-- -->example, if <code>func</code> is called 3 times in a row: <code>func(1); func(2); func(3);</code> it will wait <code>wait</code> ms between each run: <code>func(1); await sleep(wait); func(2); await sleep(wait); func(3);</code></p><p>This is not throttling (!) since eventually all calls will be ran, while in throttling the calls in the "wait" period are skipped.</p> |
| [enforceSequentialExecution(fn)](https://wixplosives.github.io/core3-utils/common.enforcesequentialexecution) | Ensures that when the async function <code>fn</code> is called twice in a row, the second call only begins after the first one has finished (successfully or not). |
| [enumValues(enumObj)](https://wixplosives.github.io/core3-utils/common.enumvalues) | |
| [enumValues(enumObj)](https://wixplosives.github.io/core3-utils/common.enumvalues_1) | |
| [equalIdents(reference, modified, newline)](https://wixplosives.github.io/core3-utils/common.equalidents) | Matches the indentation of modified to the one of reference |
| [errorToPlainObject(error)](https://wixplosives.github.io/core3-utils/common.errortoplainobject) | |
| [escapeRegExp(str)](https://wixplosives.github.io/core3-utils/common.escaperegexp) | Returns a string safe to be used in RegExp |
| [every(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.every) | |
| [exclude(excluded)](https://wixplosives.github.io/core3-utils/common.exclude) | |
| [filter(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.filter) | |
| [find(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.find) | |
| [first(iterable)](https://wixplosives.github.io/core3-utils/common.first) | Picks the first element of an iterable |
| [flat(iterable, deep)](https://wixplosives.github.io/core3-utils/common.flat) | |
| [flatMap(iterable, mapFn)](https://wixplosives.github.io/core3-utils/common.flatmap) | |
| [forEach(iterable, fn)](https://wixplosives.github.io/core3-utils/common.foreach) | |
| [get(obj, key)](https://wixplosives.github.io/core3-utils/common.get) | Similar to Map.get, but works for plain objects, and returns undefined for null maps and missing keys |
| [get(obj, key)](https://wixplosives.github.io/core3-utils/common.get_1) | |
| [getCartesianProductOfArrays(arrays)](https://wixplosives.github.io/core3-utils/common.getcartesianproductofarrays) | |
| [getErrorCode(error)](https://wixplosives.github.io/core3-utils/common.geterrorcode) | Returns error.code property if the error object has it, otherwise returns undefined. |
| [getIn(obj, path)](https://wixplosives.github.io/core3-utils/common.getin) | |
| [getValue(map, key, errorMessage)](https://wixplosives.github.io/core3-utils/common.getvalue) | Returns a value by key, throws if the value is missing or the map null |
| [getValue(map, key, errorMessage)](https://wixplosives.github.io/core3-utils/common.getvalue_1) | |
| [getValue(map, key, errorMessage)](https://wixplosives.github.io/core3-utils/common.getvalue_2) | |
| [groupBy(elements, property)](https://wixplosives.github.io/core3-utils/common.groupby) | Groups elements by the value of a property |
| [has(obj, key)](https://wixplosives.github.io/core3-utils/common.has) | Similar to Map.has, but works for plain objects, and returns false for null maps |
| [has(obj, key)](https://wixplosives.github.io/core3-utils/common.has_1) | Similar to Map.has, but works for plain objects, and returns false for null maps |
| [has(obj, key)](https://wixplosives.github.io/core3-utils/common.has_2) | |
| [histogram(iterable)](https://wixplosives.github.io/core3-utils/common.histogram) | Calculate a histogram of iterable elements |
| [includes(iterable, item)](https://wixplosives.github.io/core3-utils/common.includes) | |
| [includesCaseInsensitive(str, substr)](https://wixplosives.github.io/core3-utils/common.includescaseinsensitive) | Checks if str contains substr ignoring capitalization |
| [indexToLineAndColumn(content, pos, newline)](https://wixplosives.github.io/core3-utils/common.indextolineandcolumn) | Finds line an column by position index |
| [isDefined(value)](https://wixplosives.github.io/core3-utils/common.isdefined) | Given a value of type Nullable<T>, validates value is T |
| [isEmpty(iterable)](https://wixplosives.github.io/core3-utils/common.isempty) | Checks if an iterable is empty |
| [isErrorLikeObject(error)](https://wixplosives.github.io/core3-utils/common.iserrorlikeobject) | |
| [isIterable(x)](https://wixplosives.github.io/core3-utils/common.isiterable) | |
| [isPlainObject(value)](https://wixplosives.github.io/core3-utils/common.isplainobject) | Checks that value is a POJO |
| [isValidNamingConvention(namingConvention)](https://wixplosives.github.io/core3-utils/common.isvalidnamingconvention) | Checks if namingConvention is supported |
| [join(iterable, separator)](https://wixplosives.github.io/core3-utils/common.join) | |
| [keys(map)](https://wixplosives.github.io/core3-utils/common.keys) | |
| [keys(map)](https://wixplosives.github.io/core3-utils/common.keys_1) | |
| [last(iterable)](https://wixplosives.github.io/core3-utils/common.last) | Picks the last element of an iterable |
| [map(iterable, mapFn)](https://wixplosives.github.io/core3-utils/common.map) | Map iterable elements |
| [mapKeys(obj, mapping)](https://wixplosives.github.io/core3-utils/common.mapkeys) | Maps values of a plain object |
| [mapObject(obj, mapping)](https://wixplosives.github.io/core3-utils/common.mapobject) | Maps key value pairs of a plain object |
| [mapValues(obj, mapping)](https://wixplosives.github.io/core3-utils/common.mapvalues) | Maps values of a plain object |
| [minimalIndent(str)](https://wixplosives.github.io/core3-utils/common.minimalindent) | Shifts all indentation to the left using the line with the least indentation as a baseline |
| [mulberry32(a)](https://wixplosives.github.io/core3-utils/common.mulberry32) | |
| [naiveStripComments(str)](https://wixplosives.github.io/core3-utils/common.naivestripcomments) | Removes comments from string Note that there's lexical no parsing, so stuff like "//'//" will not work |
| [next(iterable, item)](https://wixplosives.github.io/core3-utils/common.next) | Find the element following an item |
| [noIdents(modified, separator)](https://wixplosives.github.io/core3-utils/common.noidents) | Remove line indentation (heading whitespace) |
| [normToRage(normal, min, max)](https://wixplosives.github.io/core3-utils/common.normtorage) | |
| [noWhiteSpace(str)](https://wixplosives.github.io/core3-utils/common.nowhitespace) | Remove white spaces including empty lines |
| [once(fn)](https://wixplosives.github.io/core3-utils/common.once) | Make a function executable only once, following calls are ignored |
| [pick(record, keys)](https://wixplosives.github.io/core3-utils/common.pick) | returns an object composed of the picked object properties |
| [prev(iterable, item)](https://wixplosives.github.io/core3-utils/common.prev) | Find the element before an item |
| [reduce(iterable, reducer, initial)](https://wixplosives.github.io/core3-utils/common.reduce) | |
| [reportError_2(ex)](https://wixplosives.github.io/core3-utils/common.reporterror_2) | Logs an error |
| [reverseObject(obj)](https://wixplosives.github.io/core3-utils/common.reverseobject) | Reverses keys-values of an object, ignoring falsy values. First takes on value collisions. |
| [same(a, b, unordered)](https://wixplosives.github.io/core3-utils/common.same) | Deep comparison of two objects |
| [size(iterable)](https://wixplosives.github.io/core3-utils/common.size) | Evaluate the size of an iterable |
| [skip(iterable, count)](https://wixplosives.github.io/core3-utils/common.skip) | Skips the first elements of an iterable |
| [some(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.some) | |
| [sort(iterable, by)](https://wixplosives.github.io/core3-utils/common.sort) | |
| [stringifyErrorStack(error)](https://wixplosives.github.io/core3-utils/common.stringifyerrorstack) | |
| [templateCompilerProvider(context)](https://wixplosives.github.io/core3-utils/common.templatecompilerprovider) | Similar to templated string, given a fixed context object returns a function that parses strings in it |
| [toCamelCase(str)](https://wixplosives.github.io/core3-utils/common.tocamelcase) | Converts a string to camelCase |
| [toCSSCamelCase(str)](https://wixplosives.github.io/core3-utils/common.tocsscamelcase) | like [toCamelCase()](https://wixplosives.github.io/core3-utils/common.tocamelcase)<!-- -->, but capitalizes first character if input starts with '-' |
| [toCSSKebabCase(str)](https://wixplosives.github.io/core3-utils/common.tocsskebabcase) | like [toKebabCase()](https://wixplosives.github.io/core3-utils/common.tokebabcase)<!-- -->, but prepends '-' if first character of input is UpperCase |
| [toError(value)](https://wixplosives.github.io/core3-utils/common.toerror) | Convert any kind of value to an error instance. Unless the value is already an error instance, it's stringified and used as the error message. |
| [toKebabCase(str)](https://wixplosives.github.io/core3-utils/common.tokebabcase) | Converts a string to kebab-case |
| [toNamingConvention(str, namingConvention)](https://wixplosives.github.io/core3-utils/common.tonamingconvention) | Converts string formatting to a naming convention |
| [toPascalCase(str)](https://wixplosives.github.io/core3-utils/common.topascalcase) | Converts a string to PascalCase |
| [toPascalCaseJsIdentifier(str)](https://wixplosives.github.io/core3-utils/common.topascalcasejsidentifier) | Similar to [toPascalCase()](https://wixplosives.github.io/core3-utils/common.topascalcase)<!-- -->, but drops heading non-letters |
| [unique(iterable, by)](https://wixplosives.github.io/core3-utils/common.unique) | Creates iterable of unique elements |
| [values(map)](https://wixplosives.github.io/core3-utils/common.values) | |
| [values(map)](https://wixplosives.github.io/core3-utils/common.values_1) | |
| Function | Description |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [assertIsString(value, errorMessage)](https://wixplosives.github.io/core3-utils/common.assertisstring) | Throws if value is not a string |
| [at(iterable, index)](https://wixplosives.github.io/core3-utils/common.at) | Finds element by index, including negative index |
| [awaitRecord(obj)](https://wixplosives.github.io/core3-utils/common.awaitrecord) | Awaits a record of promises, and returns a record of their results. |
| [capitalizeFirstLetter(val)](https://wixplosives.github.io/core3-utils/common.capitalizefirstletter) | Capitalize the first letter of a string |
| [chain(value)](https://wixplosives.github.io/core3-utils/common.chain) | Chain iterable operations, each acting on the output of the previous step |
| [chain(value)](https://wixplosives.github.io/core3-utils/common.chain_1) | Chain iterable operations, each acting on the output of the previous step |
| [clamp(value, min, max)](https://wixplosives.github.io/core3-utils/common.clamp) | |
| [concat(iterables)](https://wixplosives.github.io/core3-utils/common.concat) | |
| [createRandomIntWithSeed(seed)](https://wixplosives.github.io/core3-utils/common.createrandomintwithseed) | |
| [defaults(\_source, \_defaultValues, deep, shouldUseDefault)](https://wixplosives.github.io/core3-utils/common.defaults) | Returns an object where missing keys and values/keys that satisfy shouldUseDefault to the value in shouldUseDefault. |
| [delayed(fn, wait)](https://wixplosives.github.io/core3-utils/common.delayed) | Ensures <code>func</code> will be called with at least <code>wait</code> ms between runs. |
| [enforceSequentialExecution(fn)](https://wixplosives.github.io/core3-utils/common.enforcesequentialexecution) | Ensures that when the async function <code>fn</code> is called twice in a row, the second call only begins after the first one has finished (successfully or not). |
| [enumValues(enumObj)](https://wixplosives.github.io/core3-utils/common.enumvalues) | |
| [enumValues(enumObj)](https://wixplosives.github.io/core3-utils/common.enumvalues_1) | |
| [equalIdents(reference, modified, newline)](https://wixplosives.github.io/core3-utils/common.equalidents) | Matches the indentation of modified to the one of reference |
| [errorToPlainObject(error)](https://wixplosives.github.io/core3-utils/common.errortoplainobject) | |
| [escapeRegExp(str)](https://wixplosives.github.io/core3-utils/common.escaperegexp) | Returns a string safe to be used in RegExp |
| [every(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.every) | |
| [exclude(excluded)](https://wixplosives.github.io/core3-utils/common.exclude) | |
| [filter(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.filter) | |
| [find(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.find) | |
| [first(iterable)](https://wixplosives.github.io/core3-utils/common.first) | Picks the first element of an iterable |
| [flat(iterable, deep)](https://wixplosives.github.io/core3-utils/common.flat) | |
| [flatMap(iterable, mapFn)](https://wixplosives.github.io/core3-utils/common.flatmap) | |
| [forEach(iterable, fn)](https://wixplosives.github.io/core3-utils/common.foreach) | |
| [get(obj, key)](https://wixplosives.github.io/core3-utils/common.get) | Similar to Map.get, but works for plain objects, and returns undefined for null maps and missing keys |
| [get(obj, key)](https://wixplosives.github.io/core3-utils/common.get_1) | |
| [getCartesianProduct(arrays)](https://wixplosives.github.io/core3-utils/common.getcartesianproduct) | |
| [getErrorCode(error)](https://wixplosives.github.io/core3-utils/common.geterrorcode) | Returns error.code property if the error object has it, otherwise returns undefined. |
| [getIn(obj, path)](https://wixplosives.github.io/core3-utils/common.getin) | |
| [getValue(map, key, errorMessage)](https://wixplosives.github.io/core3-utils/common.getvalue) | Returns a value by key, throws if the value is missing or the map null |
| [getValue(map, key, errorMessage)](https://wixplosives.github.io/core3-utils/common.getvalue_1) | |
| [getValue(map, key, errorMessage)](https://wixplosives.github.io/core3-utils/common.getvalue_2) | |
| [groupBy(elements, property)](https://wixplosives.github.io/core3-utils/common.groupby) | Groups elements by the value of a property |
| [has(obj, key)](https://wixplosives.github.io/core3-utils/common.has) | Similar to Map.has, but works for plain objects, and returns false for null maps |
| [has(obj, key)](https://wixplosives.github.io/core3-utils/common.has_1) | Similar to Map.has, but works for plain objects, and returns false for null maps |
| [has(obj, key)](https://wixplosives.github.io/core3-utils/common.has_2) | |
| [histogram(iterable)](https://wixplosives.github.io/core3-utils/common.histogram) | Calculate a histogram of iterable elements |
| [includes(iterable, item)](https://wixplosives.github.io/core3-utils/common.includes) | |
| [includesCaseInsensitive(str, substr)](https://wixplosives.github.io/core3-utils/common.includescaseinsensitive) | Checks if str contains substr ignoring capitalization |
| [indexToLineAndColumn(content, pos, newline)](https://wixplosives.github.io/core3-utils/common.indextolineandcolumn) | Finds line an column by position index |
| [isDefined(value)](https://wixplosives.github.io/core3-utils/common.isdefined) | Given a value of type Nullable<T>, validates value is T |
| [isEmpty(iterable)](https://wixplosives.github.io/core3-utils/common.isempty) | Checks if an iterable is empty |
| [isErrorLikeObject(error)](https://wixplosives.github.io/core3-utils/common.iserrorlikeobject) | |
| [isIterable(x)](https://wixplosives.github.io/core3-utils/common.isiterable) | |
| [isPlainObject(value)](https://wixplosives.github.io/core3-utils/common.isplainobject) | Checks that value is a POJO |
| [isValidNamingConvention(namingConvention)](https://wixplosives.github.io/core3-utils/common.isvalidnamingconvention) | Checks if namingConvention is supported |
| [join(iterable, separator)](https://wixplosives.github.io/core3-utils/common.join) | |
| [keys(map)](https://wixplosives.github.io/core3-utils/common.keys) | |
| [keys(map)](https://wixplosives.github.io/core3-utils/common.keys_1) | |
| [last(iterable)](https://wixplosives.github.io/core3-utils/common.last) | Picks the last element of an iterable |
| [map(iterable, mapFn)](https://wixplosives.github.io/core3-utils/common.map) | Map iterable elements |
| [mapKeys(obj, mapping)](https://wixplosives.github.io/core3-utils/common.mapkeys) | Maps values of a plain object |
| [mapObject(obj, mapping)](https://wixplosives.github.io/core3-utils/common.mapobject) | Maps key value pairs of a plain object |
| [mapValues(obj, mapping)](https://wixplosives.github.io/core3-utils/common.mapvalues) | Maps values of a plain object |
| [minimalIndent(str)](https://wixplosives.github.io/core3-utils/common.minimalindent) | Shifts all indentation to the left using the line with the least indentation as a baseline |
| [mulberry32(a)](https://wixplosives.github.io/core3-utils/common.mulberry32) | |
| [naiveStripComments(str)](https://wixplosives.github.io/core3-utils/common.naivestripcomments) | Removes comments from string Note that there's lexical no parsing, so stuff like "//'//" will not work |
| [next(iterable, item)](https://wixplosives.github.io/core3-utils/common.next) | Find the element following an item |
| [noIdents(modified, separator)](https://wixplosives.github.io/core3-utils/common.noidents) | Remove line indentation (heading whitespace) |
| [normToRage(normal, min, max)](https://wixplosives.github.io/core3-utils/common.normtorage) | |
| [noWhiteSpace(str)](https://wixplosives.github.io/core3-utils/common.nowhitespace) | Remove white spaces including empty lines |
| [once(fn)](https://wixplosives.github.io/core3-utils/common.once) | Make a function executable only once, following calls are ignored |
| [pick(record, keys)](https://wixplosives.github.io/core3-utils/common.pick) | returns an object composed of the picked object properties |
| [prev(iterable, item)](https://wixplosives.github.io/core3-utils/common.prev) | Find the element before an item |
| [randomizedOrder(size)](https://wixplosives.github.io/core3-utils/common.randomizedorder) | |
| [reduce(iterable, reducer, initial)](https://wixplosives.github.io/core3-utils/common.reduce) | |
| [reportError_2(ex)](https://wixplosives.github.io/core3-utils/common.reporterror_2) | Logs an error |
| [reverseObject(obj)](https://wixplosives.github.io/core3-utils/common.reverseobject) | Reverses keys-values of an object, ignoring falsy values. First takes on value collisions. |
| [same(a, b, unordered)](https://wixplosives.github.io/core3-utils/common.same) | Deep comparison of two objects |
| [shuffle(array)](https://wixplosives.github.io/core3-utils/common.shuffle) | Shuffles an array |
| [size(iterable)](https://wixplosives.github.io/core3-utils/common.size) | Evaluate the size of an iterable |
| [skip(iterable, count)](https://wixplosives.github.io/core3-utils/common.skip) | Skips the first elements of an iterable |
| [some(iterable, predicate)](https://wixplosives.github.io/core3-utils/common.some) | |
| [sort(iterable, by)](https://wixplosives.github.io/core3-utils/common.sort) | |
| [stringifyErrorStack(error)](https://wixplosives.github.io/core3-utils/common.stringifyerrorstack) | |
| [swap(array, i, j)](https://wixplosives.github.io/core3-utils/common.swap) | Swaps elements of an array in place |
| [templateCompilerProvider(context)](https://wixplosives.github.io/core3-utils/common.templatecompilerprovider) | Similar to templated string, given a fixed context object returns a function that parses strings in it |
| [toCamelCase(str)](https://wixplosives.github.io/core3-utils/common.tocamelcase) | Converts a string to camelCase |
| [toCSSCamelCase(str)](https://wixplosives.github.io/core3-utils/common.tocsscamelcase) | like [toCamelCase()](https://wixplosives.github.io/core3-utils/common.tocamelcase)<!-- -->, but capitalizes first character if input starts with '-' |
| [toCSSKebabCase(str)](https://wixplosives.github.io/core3-utils/common.tocsskebabcase) | like [toKebabCase()](https://wixplosives.github.io/core3-utils/common.tokebabcase)<!-- -->, but prepends '-' if first character of input is UpperCase |
| [toError(value)](https://wixplosives.github.io/core3-utils/common.toerror) | Convert any kind of value to an error instance. Unless the value is already an error instance, it's stringified and used as the error message. |
| [toKebabCase(str)](https://wixplosives.github.io/core3-utils/common.tokebabcase) | Converts a string to kebab-case |
| [toNamingConvention(str, namingConvention)](https://wixplosives.github.io/core3-utils/common.tonamingconvention) | Converts string formatting to a naming convention |
| [toPascalCase(str)](https://wixplosives.github.io/core3-utils/common.topascalcase) | Converts a string to PascalCase |
| [toPascalCaseJsIdentifier(str)](https://wixplosives.github.io/core3-utils/common.topascalcasejsidentifier) | Similar to [toPascalCase()](https://wixplosives.github.io/core3-utils/common.topascalcase)<!-- -->, but drops heading non-letters |
| [unique(iterable, by)](https://wixplosives.github.io/core3-utils/common.unique) | Creates iterable of unique elements |
| [values(map)](https://wixplosives.github.io/core3-utils/common.values) | |
| [values(map)](https://wixplosives.github.io/core3-utils/common.values_1) | |

@@ -117,0 +120,0 @@ ## Variables

@@ -31,7 +31,13 @@ import { sleep } from 'promise-assist';

* Ensures `func` will be called with at least `wait` ms between runs.
* For @example, if `func` is called 3 times in a row:
* `func(1); func(2); func(3);`
* it will wait `wait` ms between each run:
* `func(1); await sleep(wait); func(2); await sleep(wait); func(3);`
*
* @example
* ```ts
* // if `func` is called 3 times in a row:
* func(1); func(2); func(3);
* // it will wait `wait` ms between each run:
* func(1);
* await sleep(wait);
* func(2);
* await sleep(wait);
* func(3);`
* ```
* This is not throttling (!) since eventually all calls will be ran,

@@ -38,0 +44,0 @@ * while in throttling the calls in the "wait" period are skipped.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc