|
1 | | -# conditional-helpers |
| 1 | +# Conditional Helpers |
2 | 2 |
|
3 | | -A collection of JavaScript helper functions to be used in conditional logic within projects |
| 3 | +A collection of JavaScript helper functions to be used in conditional logic within projects. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Installation](#installation) |
| 8 | +- [Usage](#usage) |
| 9 | +- [Functions](#functions) |
| 10 | +- [License](#license) |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +To install the `conditional-helpers` package, run the following command in your terminal: |
| 15 | + |
| 16 | +```bash |
| 17 | +npm install conditional-helpers |
| 18 | +``` |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +Import the conditional-helpers package in your JavaScript file and use the helper functions as needed. For example: |
| 23 | + |
| 24 | +```js |
| 25 | +import { isString, isNumber, isArray } from "conditional-helpers"; |
| 26 | + |
| 27 | +console.log(isString("hello")); // true |
| 28 | +console.log(isNumber(42)); // true |
| 29 | +console.log(isArray([1, 2, 3])); // true |
| 30 | +``` |
| 31 | + |
| 32 | +## Functions |
| 33 | + |
| 34 | +The following helper functions are available in the conditional-helpers package: |
| 35 | + |
| 36 | +- isArray: Checks if a value is an array. |
| 37 | +- isBoolean: Checks if a value is a boolean. |
| 38 | +- isBooleanFalsey: Checks if a boolean value is falsey. |
| 39 | +- isBooleanTruthy: Checks if a boolean value is truthy. |
| 40 | +- isDate: Checks if a value is a date. |
| 41 | +- isFunction: Checks if a value is a function. |
| 42 | +- isHTML: Checks if a value is an HTML string. |
| 43 | +- isNumber: Checks if a value is a number. |
| 44 | +- isObject: Checks if a value is an object. |
| 45 | +- isObjectEmpty: Checks if an object is empty. |
| 46 | +- isObjectHasProps: Checks if an object has properties. |
| 47 | +- isString: Checks if a value is a string. |
| 48 | +- isStringEmpty: Checks if a string is empty. |
| 49 | +- isStringHasLength: Checks if a string has length. |
| 50 | +- isArrayEmpty: Checks if an array is empty. |
| 51 | +- isArrayHasLength: Checks if an array has length. |
| 52 | +- hasLength: Checks if a value has length. |
| 53 | + |
| 54 | +## License |
| 55 | + |
| 56 | +The conditional-helpers package is licensed under the ISC license. |
0 commit comments