2.0.0 • Published 6 months ago
@ulisesgascon/simplify-object v2.0.0
About
A simple way to return a new object with less properties
❤️ Awesome Features:
- Simple and easy to use 🔥
- Typescript support 💪
- Zero dependencies 🚀
- Easy to use and great test coverage ✅
Installation
npm install @ulisesgascon/simplify-object
Usage
Simple example
Importation
const { simplifyObject } = require("@ulisesgascon/simplify-object");
import { simplifyObject } from "@ulisesgascon/simplify-object";
Usage
const user = {
name: "Jane",
nickname: "JaneDoe",
isAdmin: true,
age: 120,
bio: "Hacker life",
};
// Just create a copy with less stuff
const simpleUser = simplifyObject(user, {
exclude: ["name", "bio", "age"],
});
console.log(simpleUser);
// Just create a copy with specific things
const simpleUser2 = simplifyObject(user, {
include: ["name", "bio", "age"],
});
console.log(simpleUser2); // {name: "Jane",bio: "Hacker life", age: 120 }
Known limitations
The new Object has been created by using the shallow copy estrategy
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Ulises Gascón - Initial work- - @ulisesGascon
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- This project is under development, but you can help us to improve it! We :heart: FOSS!