Skip to content

Commit

Permalink
updated metod names to more meaningful.
Browse files Browse the repository at this point in the history
  • Loading branch information
muratgozel committed Apr 4, 2023
1 parent 6e6caea commit e72d6e8
Show file tree
Hide file tree
Showing 64 changed files with 882 additions and 609 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ getCities() // [{code: "01", name: "Adana"}, ... {code: "67", name: "Zonguldak"}
getPostalCodes() // ["01720", ... "67100"]
isPostalCode('01720') // true

getCityDistricts('16') // ["Büyükorhan", "Gemlik", "Gürsu", ... "Yıldırım"]
getCityDistrictNeighbourhoods('16') // {"Büyükorhan": ["Akçasaz Mah", "Aktaş Mah", ...], "Gemlik": ["Adliye Mah", ...], ...}
getDistrictsByCityCode('16') // ["Büyükorhan", "Gemlik", "Gürsu", ... "Yıldırım"]
getDistrictsOfEachCity() // {"16": ["Nilüfer", ...]}
getDistrictsAndNeighbourhoodsByCityCode('16') // {"Büyükorhan": ["Akçasaz Mah", "Aktaş Mah", ...], "Gemlik": ["Adliye Mah", ...], ...}
getDistrictsAndNeighbourhoodsOfEachCity() // {"16": {"Gemlik": ["Adliye Mah", ...] ...} ...}
getNeighbourhoodsByCityCodeAndDistrict("16", "Nilüfer") // ["Alaaddinbey Mah", "Ataevler Mah" ...]

// find distance between two cities in kilometers based on the roads
findDistance('41', '16') // 131
Expand Down
11 changes: 7 additions & 4 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,18 @@ export const getPostalCodes = () => {
export const isPostalCode = (v) => {
return typeof v === 'string' && postalCodes.find((code) => code === v) !== undefined;
};
export const getCityDistricts = (code) => {
export const getDistrictsByCityCode = (code) => {
return mapCodeDistricts[code] || [];
};
export const getAllCityDistricts = () => {
export const getDistrictsOfEachCity = () => {
return mapCodeDistricts;
};
export const getCityDistrictNeighbourhoods = (code) => {
export const getDistrictsAndNeighbourhoodsByCityCode = (code) => {
return mapCodeDistrictNeighbourhoods[code] || {};
};
export const getAllNeighbourhoods = () => {
export const getDistrictsAndNeighbourhoodsOfEachCity = () => {
return mapCodeDistrictNeighbourhoods;
};
export const getNeighbourhoodsByCityCodeAndDistrict = (code, district) => {
return (mapCodeDistrictNeighbourhoods[code] || {})[district] || [];
};
29 changes: 17 additions & 12 deletions dist/cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ __export(build_exports, {
castCityName: () => castCityName,
findClosestCities: () => findClosestCities,
findDistance: () => findDistance,
getAllCityDistricts: () => getAllCityDistricts,
getAllNeighbourhoods: () => getAllNeighbourhoods,
getCities: () => getCities,
getCityCodes: () => getCityCodes,
getCityDistrictNeighbourhoods: () => getCityDistrictNeighbourhoods,
getCityDistricts: () => getCityDistricts,
getCityNames: () => getCityNames,
getDistrictsAndNeighbourhoodsByCityCode: () => getDistrictsAndNeighbourhoodsByCityCode,
getDistrictsAndNeighbourhoodsOfEachCity: () => getDistrictsAndNeighbourhoodsOfEachCity,
getDistrictsByCityCode: () => getDistrictsByCityCode,
getDistrictsOfEachCity: () => getDistrictsOfEachCity,
getNeighbourhoodsByCityCodeAndDistrict: () => getNeighbourhoodsByCityCodeAndDistrict,
getPostalCodes: () => getPostalCodes,
isArray: () => isArray,
isCity: () => isCity,
Expand Down Expand Up @@ -157134,31 +157135,35 @@ var getPostalCodes = () => {
var isPostalCode = (v) => {
return typeof v === "string" && postalCodes.find((code) => code === v) !== void 0;
};
var getCityDistricts = (code) => {
var getDistrictsByCityCode = (code) => {
return mapCodeDistricts[code] || [];
};
var getAllCityDistricts = () => {
var getDistrictsOfEachCity = () => {
return mapCodeDistricts;
};
var getCityDistrictNeighbourhoods = (code) => {
var getDistrictsAndNeighbourhoodsByCityCode = (code) => {
return mapCodeDistrictNeighbourhoods[code] || {};
};
var getAllNeighbourhoods = () => {
var getDistrictsAndNeighbourhoodsOfEachCity = () => {
return mapCodeDistrictNeighbourhoods;
};
var getNeighbourhoodsByCityCodeAndDistrict = (code, district) => {
return (mapCodeDistrictNeighbourhoods[code] || {})[district] || [];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
castCityCode,
castCityName,
findClosestCities,
findDistance,
getAllCityDistricts,
getAllNeighbourhoods,
getCities,
getCityCodes,
getCityDistrictNeighbourhoods,
getCityDistricts,
getCityNames,
getDistrictsAndNeighbourhoodsByCityCode,
getDistrictsAndNeighbourhoodsOfEachCity,
getDistrictsByCityCode,
getDistrictsOfEachCity,
getNeighbourhoodsByCityCodeAndDistrict,
getPostalCodes,
isArray,
isCity,
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions docs/functions/src.castCityCode.html

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions docs/functions/src.castCityName.html

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions docs/functions/src.findClosestCities.html

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions docs/functions/src.findDistance.html

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions docs/functions/src.getCities.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>getCities | turkey-neighbourhoods - v3.0.2</title><meta name="description" content="Documentation for turkey-neighbourhoods - v3.0.2"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>getCities | turkey-neighbourhoods - v3.0.3</title><meta name="description" content="Documentation for turkey-neighbourhoods - v3.0.3"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
<div class="tsd-toolbar-contents container">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
<div class="field">
<div id="tsd-toolbar-links"></div></div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">turkey-neighbourhoods - v3.0.2</a></div>
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">turkey-neighbourhoods - v3.0.3</a></div>
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
<div class="container container-main">
<div class="col-8 col-content">
<div class="tsd-page-title">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">turkey-neighbourhoods - v3.0.2</a></li>
<li><a href="../modules.html">turkey-neighbourhoods - v3.0.3</a></li>
<li><a href="../modules/src.html">src</a></li>
<li><a href="src.getCities.html">getCities</a></li></ul>
<h1>Function getCities</h1></div>
Expand All @@ -22,7 +22,7 @@ <h1>Function getCities</h1></div>
<li class="tsd-description">
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">CityListItem</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/muratgozel/turkey-neighbourhoods/blob/14968e4/src/index.ts#L113">src/index.ts:113</a></li></ul></aside></li></ul></section></div>
<li>Defined in <a href="https://github.com/muratgozel/turkey-neighbourhoods/blob/6e6caea/src/index.ts#L113">src/index.ts:113</a></li></ul></aside></li></ul></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand All @@ -41,7 +41,7 @@ <h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
<div class="tsd-accordion-details">
<ul>
<li class="current"><a href="../modules.html">turkey-<wbr/>neighbourhoods -<wbr/> v3.0.2</a>
<li class="current"><a href="../modules.html">turkey-<wbr/>neighbourhoods -<wbr/> v3.0.3</a>
<ul>
<li class="current tsd-kind-module"><a href="../modules/src.html">src</a></li>
<li class="tsd-kind-module"><a href="../modules/types.html">types</a></li></ul></li></ul></div></details></nav>
Expand All @@ -51,13 +51,14 @@ <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.9389
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.castCityName.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>cast<wbr/>City<wbr/>Name</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.findClosestCities.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>find<wbr/>Closest<wbr/>Cities</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.findDistance.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>find<wbr/>Distance</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getAllCityDistricts.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>All<wbr/>City<wbr/>Districts</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getAllNeighbourhoods.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>All<wbr/>Neighbourhoods</a></li>
<li class="current tsd-kind-function tsd-parent-kind-module"><a href="src.getCities.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Cities</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getCityCodes.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>City<wbr/>Codes</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getCityDistrictNeighbourhoods.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>City<wbr/>District<wbr/>Neighbourhoods</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getCityDistricts.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>City<wbr/>Districts</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getCityNames.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>City<wbr/>Names</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getDistrictsAndNeighbourhoodsByCityCode.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Districts<wbr/>And<wbr/>Neighbourhoods<wbr/>By<wbr/>City<wbr/>Code</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getDistrictsAndNeighbourhoodsOfEachCity.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Districts<wbr/>And<wbr/>Neighbourhoods<wbr/>Of<wbr/>Each<wbr/>City</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getDistrictsByCityCode.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Districts<wbr/>By<wbr/>City<wbr/>Code</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getDistrictsOfEachCity.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Districts<wbr/>Of<wbr/>Each<wbr/>City</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getNeighbourhoodsByCityCodeAndDistrict.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Neighbourhoods<wbr/>By<wbr/>City<wbr/>Code<wbr/>And<wbr/>District</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.getPostalCodes.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>get<wbr/>Postal<wbr/>Codes</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.isArray.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>is<wbr/>Array</a></li>
<li class="tsd-kind-function tsd-parent-kind-module"><a href="src.isCity.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>is<wbr/>City</a></li>
Expand Down
Loading

0 comments on commit e72d6e8

Please sign in to comment.