index.js
function getProvinceByNameOrShortName(name, useAlias) {
  if (!_.isString(name) || !_.isArray(this.provinces)) return undefined;

  return _.find(this.provinces, (province) => {
    if (useAlias) {
      return province.name.toUpperCase() === name.toUpperCase()
        || (province.short && province.short.toUpperCase() === name.toUpperCase())
        ||  _.find(province.alias, (alias) => (alias.toUpperCase() === name.toUpperCase()));
    }
    return province.name.toUpperCase() === name.toUpperCase() || (province.short && province.short.toUpperCase() === name.toUpperCase());
  });
}
function getProvinceByNameOrShortName(name, useAlias) {
  if (!_.isString(name) || !_.isArray(this.provinces)) return undefined;

  return _.find(this.provinces, (province) => {
    if (useAlias) {
      return province.name.toUpperCase() === name.toUpperCase()
        || (province.short && province.short.toUpperCase() === name.toUpperCase())
        ||  _.find(province.alias, (alias) => (alias.toUpperCase() === name.toUpperCase()));
    }
    return province.name.toUpperCase() === name.toUpperCase() || (province.short && province.short.toUpperCase() === name.toUpperCase());
  });
}
function getProvinceByNameOrShortName ( name , useAlias ) { if ( ! _ . isString ( name ) || ! _ . isArray ( this . provinces ) ) return undefined ; return _ . find ( this . provinces , ( province ) => { if ( useAlias ) { return province . name . toUpperCase ( ) === name . toUpperCase ( ) || ( province . short && province . short . toUpperCase ( ) === name . toUpperCase ( ) ) || _ . find ( province . alias , ( alias ) => ( alias . toUpperCase ( ) === name . toUpperCase ( ) ) ) ; } return province . name . toUpperCase ( ) === name . toUpperCase ( ) || ( province . short && province . short . toUpperCase ( ) === name . toUpperCase ( ) ) ; } ) ; }
Find the province object of the given province name or short name

@param {String}  name              english province name or short name
@param {Boolean} [useAlias]        use alias flag, default `false`
@return {Object} province          province object
Find the province object of the given province name or short name