1.0.10 β€’ Published 4 months ago

@visulima/object v1.0.10

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

is-plain-obj, dot-prop, deeks and type-fest

typescript-image npm-image license-image



Install

npm install @visulima/object
yarn add @visulima/object
pnpm add @visulima/object

Usage

deleteProperty

escapePath

getProperty

hasProperty

setProperty

deepKeys

deepKeysFromList

isPlainObject

pick

With pick you pass an object and an array of keys of an object - the props which may stay.

import { pick } from "@visulima/object";

const squirtle = { id: "007", name: "Squirtle", type: "water" };

const newObject = pick(squirtle, ["name", "type"]);
// returns { name: 'Squirtle', type: 'water' }

const doc = { items: { keep: "πŸ“Œ", discard: "βœ‚οΈ" } };

pick(doc, ["items.keep"]);
// returns {items: {keep: 'πŸ“Œ'}}

omit

With omit you pass an object and an array of keys of an object - the props which should be removed.

import { omit } from "@visulima/object";

const squirtle = { id: "007", name: "Squirtle", type: "water" };

const withoutId = omit(squirtle, ["id"]);
// returns { name: 'Squirtle', type: 'water' }

const doc = { items: { keep: "πŸ“Œ", discard: "βœ‚οΈ" } };

omit(doc, ["items.discard"]);
// returns {items: {keep: 'πŸ“Œ'}}

Related

  • is-plain-object - Returns true if the given value is an object created by the Object constructor.
  • is-plain-obj - Check if a value is a plain object.
  • dot-prop - Get, set, or delete a property from a nested object using a dot path.
  • ts-dot-prop - TypeScript utility to transform nested objects using a dot notation path.
  • dset - A tiny (194B) utility for safely writing deep Object values~!
  • filter-anything - A simple (TypeScript) integration of "pick" and "omit" to filter props of an object.

Supported Node.js Versions

Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guidelines.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

License

The visulima object is open-sourced software licensed under the MIT

typescript-url: https://www.typescriptlang.org/ "TypeScript" "typescript"

1.0.9

6 months ago

1.0.10

4 months ago

1.0.8

6 months ago

1.0.7

7 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.2

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.1

12 months ago

1.0.0

1 year ago