Skip to content

Latest commit

 

History

History
123 lines (77 loc) · 3.45 KB

docs.md

File metadata and controls

123 lines (77 loc) · 3.45 KB

Table of Contents

getStateCities

This function returns an array with the cities of the given state

Parameters

  • stateObject Object The object the tells the name of the state.
    • stateObject.state string The state name. (optional, default requiredParam('state'))

Examples

const cities = api.getStateCities({ state: 'São Paulo' });
// { state: 'São Paulo', abbreviation: 'sp', cities: ['Santos', 'São Vicente', 'Guarujá',...] }

Returns stateType?

getCityState

This function receives the city name and returns the full json stateType object or only the name of the state depending on shouldReturnEntireJson property. If the state is not found, it returns an empty object or an empty string.

Parameters

  • cityObject Object The object the tells the name of the city and if the return should be an object or just a string.
    • cityObject.city string The city name. (optional, default requiredParam('city'))
    • cityObject.shouldReturnEntireJson boolean This property tells to the method that the return should ou should not be the full state object. If the property is true, it will return the entire stateType object, if its false or not set, it will return just the string with the name of the state. (optional, default false)

Examples

const cities = api.getCityState({ city: 'Santos', shouldReturnEntireJson: true });
// { state: 'São Paulo', abbreviation: 'sp', cities: ['Santos', 'São Vicente', 'Guarujá',...] }
const cities = api.getCityState({ city: 'Santos' });
// 'São Paulo'
const cities = api.getCityState({ city: 'Santos', shouldReturnEntireJson: false });
// 'São Paulo',
const cities = api.getCityState({ city: 'randomCity' });
// ''
const cities = api.getCityState({ city: 'randomCity' , shouldReturnEntireJson: false});
// ''
const cities = api.getCityState({ city: 'randomCity', shouldReturnEntireJson: true });
// {}

Returns (string | stateType | {})

memoizedCityType

Type with state name, abbreviation and cities

Type: Object

Properties

  • cityName stateType Name of the city, the name of the city is dinamic, e.g: Santos: stateType

memoizedStateType

Type with state name, abbreviation and cities

Type: Object

Properties

  • stateName stateType Name of the city, the name of the city is dinamic, e.g: São Paulo: stateType

stateType

Type with state name, abbreviation and cities

Type: Object

Properties

  • state String State Fullname
  • abbreviation String State name abbreviated
  • cities Array<String> Array with state cities