You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-29Lines changed: 44 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,16 @@
4
4
5
5
# js-utils
6
6
7
-
A collection of dependency-free JavaScript utilities.
7
+
This repository contains a set of simple, standalone JavaScript utility functions that I've used throughout the years in various projects. It's meant to provide useful tools that developers can easily modify and adapt for their own needs. The focus is on offering individual functions that can be changed as needed, rather than providing a full library.
8
8
9
-
## Array
9
+
The utilities are organized into packages based on their functionality. Each package contains a set of functions that are related to a specific area of development, such as arrays, strings, objects, functions, etc.
10
10
11
-
|Name|Description|
12
-
|--------|-----------|
11
+
## Table of Contents
12
+
13
+
### Array
14
+
15
+
| Name | Description |
16
+
|------|-------------|
13
17
|[chunk](https://github.com/georapbox/js-utils/tree/master/packages/arrays/chunk)|Creates an array of elements split into groups the length of size specified.|
14
18
|[compact](https://github.com/georapbox/js-utils/tree/master/packages/arrays/compact)|Creates an array with all falsy values removed. 'false', 'null', '0', '""', 'undefined', and 'NaN' are falsy.|
15
19
|[diff](https://github.com/georapbox/js-utils/tree/master/packages/arrays/diff)|Returns an array with only the unique values from the first array, by excluding all values from the second array using strict equality for comparisons.|
@@ -36,10 +40,10 @@ A collection of dependency-free JavaScript utilities.
36
40
|[uniqBy](https://github.com/georapbox/js-utils/tree/master/packages/arrays/uniqBy)|Creates a dupliate free array by accepting an `iteratee` which is invoked for each element in array.|
37
41
|[zip](https://github.com/georapbox/js-utils/tree/master/packages/arrays/zip)|Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on.|
38
42
39
-
## String
43
+
###String
40
44
41
-
|Name|Description|
42
-
|--------|-----------|
45
+
|Name|Description|
46
+
|------|-------------|
43
47
|[camelCase](https://github.com/georapbox/js-utils/tree/master/packages/strings/camelCase)|Converts a string to [camel case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles), eg `'theQuickBrownFoxJumpsOverTheLazyDog'`.|
44
48
|[capitalize](https://github.com/georapbox/js-utils/tree/master/packages/strings/capitalize)|Capitalizes the first character of a string (Optionally, converts the rest of the string to lower case).|
45
49
|[classnames](https://github.com/georapbox/js-utils/tree/master/packages/strings/classnames)|Creates a string by conditionally joining classNames together.|
@@ -66,20 +70,20 @@ A collection of dependency-free JavaScript utilities.
66
70
|[unescapeHTML](https://github.com/georapbox/js-utils/tree/master/packages/strings/unescapeHTML)|Converts the HTML entities `&`, `<`, `>`, `"`, `"` and `'` in a string to their corresponding characters.|
67
71
|[words](https://github.com/georapbox/js-utils/tree/master/packages/strings/words)|Splits string into an array of its words.|
68
72
69
-
## Object
73
+
###Object
70
74
71
-
|Name|Description|
72
-
|--------|-----------|
75
+
|Name|Description|
76
+
|------|-------------|
73
77
|[get](https://github.com/georapbox/js-utils/tree/master/packages/objects/get)|Gets the `value` at path of `object`. If the resolved value is `undefined`, the `defaultValue` is returned in its place.|
74
78
|[omit](https://github.com/georapbox/js-utils/tree/master/packages/objects/omit)|Creates an object composed of the own enumerable (not inherited) property paths of object that are not omitted.|
75
79
|[pick](https://github.com/georapbox/js-utils/tree/master/packages/objects/pick)|Creates an object composed of the picked object properties.|
76
80
|[pickBy](https://github.com/georapbox/js-utils/tree/master/packages/objects/pickBy)|Creates an object composed of the object enumerable properties that predicate returns truthy for.|
77
81
|[trueTypeOf](https://github.com/georapbox/js-utils/tree/master/packages/objects/trueTypeOf)|Determines the true type of a value using `Object.prototype.toString.call()`.|
78
82
79
-
## Function
83
+
###Function
80
84
81
-
|Name|Description|
82
-
|--------|-----------|
85
+
|Name|Description|
86
+
|------|-------------|
83
87
|[after](https://github.com/georapbox/js-utils/tree/master/packages/function/after)|Creates a function that invokes `fn` once it's called `n` or more times.|
84
88
|[ary](https://github.com/georapbox/js-utils/tree/master/packages/function/ary)|Creates a function that accepts up to `n` arguments, ignoring any additional arguments.|
85
89
|[before](https://github.com/georapbox/js-utils/tree/master/packages/function/before)|Creates a function that invokes `fn` while it’s called less than `n` times.|
@@ -95,10 +99,10 @@ A collection of dependency-free JavaScript utilities.
95
99
|[throttle](https://github.com/georapbox/js-utils/tree/master/packages/function/throttle)|Limits the number of times a function can be called in a given period.|
96
100
|[unary](https://github.com/georapbox/js-utils/tree/master/packages/function/unary)|Creates a function that accepts up to one argument, ignoring any additional arguments.|
97
101
98
-
## Is
102
+
###Is
99
103
100
-
|Name|Description|
101
-
|--------|-----------|
104
+
|Name|Description|
105
+
|------|-------------|
102
106
|[isArray](https://github.com/georapbox/js-utils/tree/master/packages/is/isArray)|Checks if a value is an array.|
103
107
|[isArrayLike](https://github.com/georapbox/js-utils/tree/master/packages/is/isArrayLike)|Checks if a value is array-like.|
104
108
|[isArrayLikeObject](https://github.com/georapbox/js-utils/tree/master/packages/is/isArrayLikeObject)|Checks if a value is array-like and object as well.|
@@ -139,10 +143,10 @@ A collection of dependency-free JavaScript utilities.
139
143
|[isWeakMap](https://github.com/georapbox/js-utils/tree/master/packages/is/isWeakMap)|Checks if a value is classified as a WeakMap object.|
140
144
|[isWeakSet](https://github.com/georapbox/js-utils/tree/master/packages/is/isWeakSet)|Checks if a value is classified as a WeakSet object.|
141
145
142
-
## Math
146
+
###Math
143
147
144
-
|Name|Description|
145
-
|--------|-----------|
148
+
|Name|Description|
149
+
|------|-------------|
146
150
|[average](https://github.com/georapbox/js-utils/tree/master/packages/math/average)|Calculates the average of a set of numbers.|
147
151
|[clamp](https://github.com/georapbox/js-utils/tree/master/packages/math/clamp)|Clamps number within the inclusive lower and upper bounds.|
148
152
|[degreesToRadians](https://github.com/georapbox/js-utils/tree/master/packages/math/degreesToRadians)|Converts degrees to radians.|
@@ -158,10 +162,10 @@ A collection of dependency-free JavaScript utilities.
158
162
|[roundToNearest](https://github.com/georapbox/js-utils/tree/master/packages/math/roundToNearest)|Rounds a number to the nearest multiple of a value provided.|
159
163
|[roundToPlaces](https://github.com/georapbox/js-utils/tree/master/packages/math/roundToPlaces)|Rounds a number to a number of desired places.|
160
164
161
-
## DOM
165
+
###DOM
162
166
163
-
|Name|Description|
164
-
|--------|-----------|
167
+
|Name|Description|
168
+
|------|-------------|
165
169
|[convertImageToBase64](https://github.com/georapbox/js-utils/tree/master/packages/dom/convertImageToBase64)|Converts an image's content to Data URI scheme.|
166
170
|[cookie](https://github.com/georapbox/js-utils/tree/master/packages/dom/cookie)|Create, read and delete cookies.|
167
171
|[highResolutionCanvas](https://github.com/georapbox/js-utils/tree/master/packages/dom/highResolutionCanvas)|Processes an `HTMLCanvasElement` by downsampling on the canvas to ensure that the drawn visuals do not look blurry on high-DPI screens.|
@@ -170,24 +174,35 @@ A collection of dependency-free JavaScript utilities.
170
174
|[whichAnimationEnd](https://github.com/georapbox/js-utils/tree/master/packages/dom/whichAnimationEnd)|Detects the supported property name for the "animationend" event.|
171
175
|[whichTransitionEnd](https://github.com/georapbox/js-utils/tree/master/packages/dom/whichTransitionEnd)|Detects the supported property name for the "transitionend" event.|
0 commit comments