function setObjectProperty(msg,prop,value,createMissing) {
    if (typeof createMissing === 'undefined') {
        createMissing = (typeof value !== 'undefined');
    }
    var msgPropParts = normalisePropertyExpression(prop, msg);
    var depth = 0;
    var length = msgPropParts.length;
    var obj = msg;
    var key;
    for (var i=0;i<length-1;i++) {
        key = msgPropParts[i];
        if (typeof key === 'string' || (typeof key === 'number' && !Array.isArray(obj))) {
            if (hasOwnProperty.call(obj, key)) {
                if (length > 1 && ((typeof obj[key] !== "object" && typeof obj[key] !== "function") || obj[key] === null)) {
                    // Break out early as we cannot create a property beneath
                    // this type of value
                    return false;
                }
                obj = obj[key];
            } else if (createMissing) {
                if (typeof msgPropParts[i+1] === 'string') {
                    obj[key] = {};
                } else {
                    obj[key] = [];
                }
                obj = obj[key];
            } else {
                return false;
            }
        } else if (typeof key === 'number') {
            // obj is an array
            if (obj[key] === undefined) {
                if (createMissing) {
                    if (typeof msgPropParts[i+1] === 'string') {
                        obj[key] = {};
                    } else {
                        obj[key] = [];
                    }
                    obj = obj[key];
                } else {
                    return false;
                }
            } else {
                obj = obj[key];
            }
        }
    }
    key = msgPropParts[length-1];
    if (typeof value === "undefined") {
        if (typeof key === 'number' && Array.isArray(obj)) {
            obj.splice(key,1);
        } else {
            delete obj[key]
        }
    } else {
        if (typeof obj === "object" && obj !== null) {
            obj[key] = value;
        } else {
            // Cannot set a property of a non-object/array
            return false;
        }
    }
    return true;
}
Sets a property of an object.

@param  {Object}  msg           - the object
@param  {String}  prop          - the property expression
@param  {any}     value         - the value to set
@param  {boolean} createMissing - whether to create missing parent properties
@memberof @node-red/util_util