1.0.3 • Published 4 months ago

js-faster v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

js-faster 🐶

Intall

npm i js-faster

or

yarn add js-faster

English document: VIEW ENGLISH

Tài liệu tiếng việt: XEM BẰNG TIẾNG VIỆT

How to use

1. formatDateString

Formats a Date object into a date string (DD/MM/YYYY).

const formattedDate = formatDateString(new Date());
// Result: 09/01/2024

2. formatDateTimeString

Formats a Date object into a time and date string (HH:mm DD/MM/YYYY).

const formattedDateTime = formatDateTimeString(new Date());
// Result: 16:46 09/01/2024

3. formatNumberWithCommas

Converts an integer to a string with comma-separated format.

const formattedNumber = formatNumberWithCommas(1000000);
// Result: 1,000,000

4. parseFormattedNumber

Converts a string with commas to an integer.

const parsedNumber = parseFormattedNumber("1,000,000");
// Result: 1000000

5. toUpperCase

Converts a string to uppercase.

const upperCaseString = toUpperCase("hello world");
// Result: HELLO WORLD

6. toLowerCase

Converts a string to lowercase.

const lowerCaseString = toLowerCase("Hello World");
// Result: hello world

7. arrayToStringWithCommas

Converts an array to a string, joining elements with commas.

const stringFromArray = arrayToStringWithCommas([1, 2, 3]);
// Result: 1,2,3

8. parseStringToArray

Converts a comma-separated string to an array of integers.

const arrayFromString = parseStringToArray("1,2,3");
// Result: [1, 2, 3]

9. isInteger

Checks if a value is an integer.

const result = isInteger(42);
// Result: true
const result = isInteger("42");
// Result: false

10. getRandomNumberInRange

Generates a random number within a specified range.

const randomNum = getRandomNumberInRange(1, 100);
// Result: [Random number between 1 and 100]

11. isArray

Checks if a value is an array.

const result = isArray([1, 2, 3]);
// Result: true
const result = isArray(1);
// Result: false

12. sortAscending

Sorts an array in ascending order.

const sortedArray = sortAscending([3, 1, 2]);
// Result: [1, 2, 3]

13. sortDescending

Sorts an array in descending order.

const sortedArray = sortDescending([3, 1, 2]);
// Result: [3, 2, 1]

14. containsNumber

Checks if a string contains a numeric character.

const result = containsNumber("Hello123");
// Result: true

Contact

NGUYEN PHUC BAO CHAU

Keyword

baochau9xx, green, js-faster, react-practical, react tools, react-native, native, baochau, thatthuvi