https://github.com/omermecitoglu/object
Object utils
https://github.com/omermecitoglu/object
Last synced: over 1 year ago
JSON representation
Object utils
- Host: GitHub
- URL: https://github.com/omermecitoglu/object
- Owner: omermecitoglu
- License: mit
- Created: 2024-12-31T07:36:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-31T07:48:45.000Z (over 1 year ago)
- Last Synced: 2025-02-19T22:14:40.227Z (over 1 year ago)
- Language: TypeScript
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Object
Provides some object utils
## Installation
Install the package using npm:
```bash
npx jsr add @omer/object
```
Or with deno:
```bash
deno add jsr:@omer/object
```
## Usage
Import the utility function and use it in your project:
```typescript
import { pick, omit, pluck } from "@omer/object";
const user = { id: 1, name: "John Doe", age: 30, password: "[REDACTED]" };
console.log(pick(user, "name", "age")); // Output: { name: "John Doe", age: 30 }
console.log(omit(user, "age", "password")); // Output: { id: 1, name: "John Doe" }
const users = [
{ id: 1, name: "John Doe", age: 30, password: "[REDACTED]" },
{ id: 2, name: "Jane Doe", age: 28, password: "[REDACTED]" },
]
console.log(pluck(users, "name")); // Output: ["John Doe", "Jane Doe"]
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.