Easy Kit Utils is a lightweight, comprehensive collection of JavaScript/TypeScript utility functions designed to simplify common programming tasks. It provides a set of helpers for array manipulation, type checking, object operations, and string formatting, fully typed with TypeScript.
- 🚀 Lightweight & Tree-shakable: Import only what you need.
- 💪 TypeScript Support: Written in TypeScript with full type definitions.
- 🛡️ Reliable: Comprehensive test suite ensures stability.
- 📦 Zero Dependencies: Pure utility functions with no external runtime dependencies.
Install the package via npm, yarn, or pnpm:
npm install easy-kit-utils
# or
yarn add easy-kit-utils
# or
pnpm add easy-kit-utilsYou can import specific functions from the main package:
import { chunk, isString, merge, capitalize } from "easy-kit-utils";
// Array Example
const array = [1, 2, 3, 4, 5];
console.log(chunk(array, 2)); // [[1, 2], [3, 4], [5]]
// Check Example
console.log(isString("hello")); // true
// Object Example
const obj1 = { a: 1 };
const obj2 = { b: 2 };
console.log(merge(obj1, obj2)); // { a: 1, b: 2 }
// String Example
console.log(capitalize("hello world")); // "Hello world"Helpers for working with arrays.
chunk: Splits an array into chunks of a specified size.groupBy: Groups array elements based on a criterion.intersection: Creates an array of unique values that are included in all given arrays.partition: Splits an array into two groups based on a predicate.uniq: Creates a duplicate-free version of an array.
Type guards and validation helpers.
isArray: Checks if value is an array.isBlankArray: Checks if an array is empty or contains only null/undefined values.isBoolean: Checks if value is a boolean.isDefined: Checks if value is defined (not null or undefined).isEmptyString: Checks if a string is empty.isFunction: Checks if value is a function.isNull: Checks if value is null.isNumber: Checks if value is a number.isObject: Checks if value is an object.isPromise: Checks if value is a promise.isString: Checks if value is a string.isTrue: Checks if value is explicitly true.isTrueFormat: Validates if a string matches a specific format (e.g. email, phone).
Helpers for object manipulation.
deepClone: Creates a deep clone of an object.get: Retrieves a value from a nested object path safely.merge: Deeply merges two objects.omit: Creates an object composed of the own and inherited enumerable property paths of object that are not omitted.pick: Creates an object composed of the picked object properties.
Helpers for string manipulation.
camelCase: Converts a string to camelCase.capitalize: Capitalizes the first character of a string.kebabCase: Converts a string to kebab-case.snakeCase: Converts a string to snake_case.truncate: Truncates a string if it's longer than the given maximum string length.
All instructions can be found in the CONTRIBUTING.md file.
If you like this project, you can support me with a very small donation.
I would be grateful 🥹
