1.0.2 • Published 2 years ago
has-props-js v1.0.2
has-props-js
The library to determines whether an object has the specified properties.
Installation
npm i has-props-jsor
yarn add has-props-jsUsage
import hasProps from "has-props-js";
const myObject = { orange: "Orange", lemon: "Lemon", watermelon: "Watermelon" };
hasProps(myObject, "orange"); // true
hasProps(myObject, ["orange", "lemon"]); // true
hasProps(myObject, ["orange", "lemon"], { pick: true }); // falseAPI
hasProps(object, props, options)
object-object(Required) - The object to checkprops-string | number | symbol | any[](Required) - The property to check, accept multiple properties as an arrayoptions-object(Optional) -options.pickoption allow theobjectcan only contain properties ofprops- return an
boolean