Node.js examples for Object:Property
Check if a property exists in an object
function canGetProperty ( /* object, propertyName1, ... */ ) { return tryGetProperty.apply( this, arguments ) !== undefined; } function tryGetProperty ( object /*, propertyName1, ... */ ) { for ( var i = 1; i < arguments.length; i += 1 ) {/*from www.jav a2s. c o m*/ if ( object === undefined ) return; var propertyName = arguments[ i ]; object = object[ propertyName ]; } return object; }