{"size": 820, "ext": "js", "max_stars_repo_path": "src/object/propOr.js", "max_stars_repo_name": "sp3ber/utils.js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/object/propOr.js", "max_issues_repo_name": "sp3ber/utils.js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/object/propOr.js", "max_forks_repo_name": "sp3ber/utils.js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.2857142857, "max_line_length": 87, "alphanum_fraction": 0.6158536585}
import curryN from '../function/curryN';
import prop from './prop';

/**
 * If the given, non-null object has an own property with the specified name,
 * returns the value of that property. Otherwise returns the provided default
 * value.
 *
 * @param {String} propName The name of the property to return.
 * @param {*} value The default value.
 * @param {Object} obj The object to query.
 * @return {*} The value of given property of the supplied object or the default value.
 * @example
 *
 *      var alice = {
 *        name: 'ALICE',
 *        age: 101
 *      };
 *
 *      propOr('name', 'Bob')(alice);  //=> 'ALICE'
 *      propOr('favoriteLibrary', 'react')(alice);  //=> 'react'
 */
export default curryN(3, (propName, value, obj) => {
    const v = prop(propName, obj);

    return v != null ? v : value;
});
