Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including cheprop with all npm packages installed. Try it out:

var cheprop = require("cheprop")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cheprop v1.0.0

Checks if the set property exists in the object. Returns boolean or the value of the property

cheprop :)


Checks if the object property is existing and/or returns the value.


var cheprop = require('cheprop');
cheprop(object,'', [proertyType]);

object : object where the property is to be found.
'' : string of property path (e.g. 'object.a.b.c' ).
propertyType: (optional) string indicating which type should property have.
Possible variants: 'array', 'null', 'nun', 'object', 'function', 'number', 'string'.


npm install cheprop
Source code available at:



const obj = {
    aa: {
        bbb: {
            cccc: 'some string',
            dddd: [1, 2, 3, 4, 5, 6],
            eeee: {
                key: 'value'
            ffff: function () {},
            gggg: 12345,
            hhhh: null,
            iiii: NaN
cheProp(obj, 'obj.aa.bbb')

Returns the value of the bbb if it exists in obj.aa

cheProp(obj, 'obj.aa.bbb', 'object')

Returns true if the bbb exists in obj.aa and the type is object
All other possible methods of getting the property are available.



npm test


Hayk Karapetyan


MIT License

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free