@aravbhivgade/ts-utility
v1.1.0
Published
this package lets you use pick, partial, read only, records, maps and exclude typescript functions in a simple manner that's also not hard to intepret by other developers
Downloads
244
Readme
TypeScript Utility Package
A utility package for TypeScript designed to simplify common operations on objects. This package enhances code readability and reduces boilerplate code in TypeScript projects by providing several helpful functions.
Overview of Features
1. Pick
Purpose: Easily create new objects with selected properties from an existing object.
Use Case: Ideal for scenarios where you only need a subset of properties from a larger object.
2. Make Partial
Purpose: Generate objects where all properties are optional.
Use Case: Useful in cases where you want to create configurations or update functions that don't require all properties to be provided.
3. Make Readonly
Purpose: Create an immutable version of an object.
Use Case: Ensures that your object cannot be modified, preventing accidental changes.
4. Create Record
Purpose: Create a new object where keys are from an array, and all values are set to a fixed value.
Use Case: Handy for initializing state or creating lookup tables.
5. Exclude From Union
Purpose: Filter out specific items from an array.
Use Case: Useful for managing lists where certain items need to be excluded based on user input or conditions.
6. Create Map
Purpose: Transform object values into a new structure using a mapping function.
Use Case: Ideal for converting data formats or applying transformations to each value in an object.
Installation
You can install the package using npm.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request. Your contributions help make this package better for everyone!
Contact
For any questions or feedback, feel free to reach out to me:
- LinkedIn: aravbhivgade
- X (Twitter): @arav190720