-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathquicksearch.html
31 lines (25 loc) · 30.6 KB
/
quicksearch.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html>
<head>
</head>
<body style="background: transparent;">
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/lunr.min.js"></script>
<script src="scripts/fulltext-search.js"></script>
<script type="text/x-docstrap-searchdb">
{"api.js.html":{"id":"api.js.html","title":"Source: api.js","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Source: api.js /** * Functions to get first day of week. * * @module api */ /** * Return first day of week for country/region code. * * @example * getWeekStartByRegion('PNG', {}); // 1 * getWeekStartByRegion('png', {BR: 0, PNG: 3, EG: 6}); // 3 * getWeekStartByRegion('qa', {QA: 6}); // 6 * getWeekStartByRegion(50, {BD: 5, 50: 5, SD: 6}); // 5 * * @param {number | string} regionCode * ISO 3166 Alpha-2, Alpha-3 or numeric code. * @param {object} regionDayMap * Mapping of country/region code to first day of week that should be used to get result. * Country codes should be in upper case. * @return {number} * Code of first day of week for the given country/region code: * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. * @alias module:api.getWeekStartByRegion */ export function getWeekStartByRegion(regionCode, regionDayMap) { /* eslint-disable indent */ const code = regionDayMap[typeof regionCode === 'string' ? regionCode.toUpperCase() : regionCode]; /* eslint-enable indent */ return typeof code === 'number' ? code : 1; } /** * Return first day of week for locale identifier. * * @example * getWeekStartByLocale('no', {}, {}); // 1 * getWeekStartByLocale('no', {no: 'abc'}, {ABC: 3}); // 3 * getWeekStartByLocale('KK_arab', {kk_arab: 'CN'}, {CN: 0}); // 0 * getWeekStartByLocale('fr-DZ', {fr: 'FR'}, {FR: 1, DZ: 6}); // 6 * * @param {string} locale * Locale identifier. * @param {object} langRegionMap * Mapping of language code to country/region code that should be used to get result. * Language codes should be in lower case. * @param {object} regionDayMap * Mapping of country/region code to first day of week that should be used to get result. * Country codes should be in upper case. * @return {number} * Code of first day of week for the given locale identifier: * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. * @alias module:api.getWeekStartByLocale */ export function getWeekStartByLocale(locale, langRegionMap, regionDayMap) { if (locale) { // Locale form: http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers const data = locale.toLowerCase().split(/[-_]/); const langTag = data[0]; let language = langTag; let country; if (data[1] && data[1].length === 4) { language += `_${data[1]}`; country = data[2]; } else { country = data[1]; } if (! country) { country = langRegionMap[language] || langRegionMap[langTag]; } if (country) { return getWeekStartByRegion( country.match(/^\\d+$/) ? Number(country) : country, regionDayMap ); } } return 1; } × Search results Close "},"full.js.html":{"id":"full.js.html","title":"Source: full.js","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Source: full.js /* * weekstart * https://github.com/gamtiq/weekstart */ /** * Library to get first day of week. * * Uses data from {@link module:fullLangRegionMap fullLangRegionMap.js} and * {@link module:regionDayMap regionDayMap.js}. * * @module full */ import * as api from './api'; import langRegionMap from './fullLangRegionMap'; import regionDayMap from './regionDayMap'; /** * Return first day of week for country/region code. * * Based on data from: * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html) * - [https://www.iso.org/iso-3166-country-codes.html](https://www.iso.org/iso-3166-country-codes.html) * * @example * getWeekStartByRegion('PNG'); // 1 * getWeekStartByRegion('qa'); // 6 * getWeekStartByRegion(462); // 5 * * @param {number | string} regionCode * ISO 3166 Alpha-2, Alpha-3 or numeric code. * @return {number} * Code of first day of week for the given country/region code: * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. * @alias module:full.getWeekStartByRegion * @see module:api.getWeekStartByRegion */ export function getWeekStartByRegion(regionCode) { return api.getWeekStartByRegion(regionCode, regionDayMap); } /** * Return first day of week for locale identifier. * * Based on data from: * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html) * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html) * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html) * - [http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers](http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers) * * @example * getWeekStartByLocale('no'); // 1 * getWeekStartByLocale('PA_arab'); // 0 * getWeekStartByLocale('fr-DZ'); // 6 * * @param {string} locale * Locale identifier. * @return {number} * Code of first day of week for the given locale identifier: * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. * @alias module:full.getWeekStartByLocale * @see module:api.getWeekStartByLocale */ export function getWeekStartByLocale(locale) { return api.getWeekStartByLocale(locale, langRegionMap, regionDayMap); } × Search results Close "},"fullLangRegionMap.js.html":{"id":"fullLangRegionMap.js.html","title":"Source: fullLangRegionMap.js","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Source: fullLangRegionMap.js /** * Contains full mapping of language code to country code. * Data only for countries which first day of week is not monday. * * @module fullLangRegionMap */ /* eslint-disable camelcase */ /** * Full mapping of language code to country code. * Contains data only for countries which first day of week is not monday. * * Based on: * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html) * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html) * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/scripts_languages_and_territories.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/scripts_languages_and_territories.html) */ const langRegionMap = { en: 'US', hi: 'IN', deva: 'IN', // script te: 'IN', mr: 'IN', ta: 'IN', gu: 'IN', kn: 'IN', or: 'IN', ml: 'IN', pa: 'IN', bho: 'IN', awa: 'IN', as: 'IN', mwr: 'IN', mai: 'IN', mag: 'IN', bgc: 'IN', hne: 'IN', dcc: 'IN', bjj: 'IN', sat: 'IN', wtm: 'IN', ks: 'IN', kok: 'IN', gom: 'IN', swv: 'IN', lmn: 'IN', gbm: 'IN', gon: 'IN', kfy: 'IN', kru: 'IN', doi: 'IN', wbq: 'IN', sck: 'IN', xnr: 'IN', wbr: 'IN', tcy: 'IN', khn: 'IN', brx: 'IN', noe: 'IN', bhb: 'IN', mni: 'IN', raj: 'IN', hoc: 'IN', mtr: 'IN', unr: 'IN', bhi: 'IN', hoj: 'IN', kha: 'IN', kfr: 'IN', grt: 'IN', unx: 'IN', bfy: 'IN', srx: 'IN', saz: 'IN', sd_deva: 'IN', ccp: 'IN', njo: 'IN', bfq: 'IN', ria: 'IN', bpy: 'IN', bra: 'IN', lep: 'IN', sa: 'IN', kht: 'IN', bn: 'BD', beng: 'BD', // script rkt: 'BD', syl: 'BD', mro: 'BD', kgp: 'BR', gub: 'BR', yrl: 'BR', xav: 'BR', dz: 'BT', tibt: 'BT', // script tsj: 'BT', tn: 'BW', pdt: 'CA', crk: 'CA', cr: 'CA', iu: 'CA', oj: 'CA', ojs: 'CA', moe: 'CA', mic: 'CA', bla: 'CA', crj: 'CA', atj: 'CA', crl: 'CA', csw: 'CA', crm: 'CA', ikt: 'CA', moh: 'CA', dgr: 'CA', den: 'CA', clc: 'CA', hur: 'CA', crg: 'CA', lil: 'CA', oka: 'CA', pqm: 'CA', kwk: 'CA', nsk: 'CA', chp: 'CA', gwi: 'CA', guc: 'CO', am: 'ET', ethi: 'ET', // script om: 'ET', ti: 'ET', sid: 'ET', wal: 'ET', aa: 'ET', quc: 'GT', ch: 'GU', id: 'ID', jv: 'ID', su: 'ID', mad: 'ID', ms_arab: 'ID', min: 'ID', bew: 'ID', ban: 'ID', bug: 'ID', bjn: 'ID', ace: 'ID', sas: 'ID', bbc: 'ID', mak: 'ID', ljp: 'ID', rej: 'ID', gor: 'ID', nij: 'ID', kge: 'ID', aoz: 'ID', kvr: 'ID', lbw: 'ID', gay: 'ID', rob: 'ID', sxn: 'ID', mdr: 'ID', sly: 'ID', mwv: 'ID', he: 'IL', hebr: 'IL', // script lad: 'IL', jam: 'JM', ja: 'JP', jpan: 'JP', // script ryu: 'JP', ki: 'KE', luy: 'KE', luo: 'KE', kln: 'KE', kam: 'KE', guz: 'KE', mer: 'KE', ebu: 'KE', dav: 'KE', pko: 'KE', saq: 'KE', km: 'KH', khmr: 'KH', // script cja: 'KH', ko: 'KR', kore: 'KR', // script lo: 'LA', laoo: 'LA', // script kjg: 'LA', hnj: 'LA', mh: 'MH', my: 'MM', mymr: 'MM', // script shn: 'MM', kac: 'MM', rhg: 'MM', mnw: 'MM', mt: 'MT', yua: 'MX', nhe: 'MX', nhw: 'MX', maz: 'MX', nch: 'MX', sei: 'MX', vmw: 'MZ', ndc: 'MZ', ngl: 'MZ', seh: 'MZ', mgh: 'MZ', rng: 'MZ', yao: 'MZ', ne: 'NP', 'new': 'NP', jml: 'NP', dty: 'NP', taj: 'NP', thl: 'NP', bap: 'NP', tdg: 'NP', thr: 'NP', mgp: 'NP', lif: 'NP', thq: 'NP', mrd: 'NP', xsr: 'NP', rjs: 'NP', tsf: 'NP', ggn: 'NP', gvr: 'NP', tkt: 'NP', tdh: 'NP', unr_deva: 'NP', qu: 'PE', fil: 'PH', ceb: 'PH', ilo: 'PH', hil: 'PH', bik: 'PH', war: 'PH', fbl: 'PH', pam: 'PH', pag: 'PH', mdh: 'PH', tsg: 'PH', cps: 'PH', krj: 'PH', bto: 'PH', hnn: 'PH', tbw: 'PH', bku: 'PH', ur: 'PK', pa_arab: 'PK', lah: 'PK', ps: 'PK', sd: 'PK', skr: 'PK', bal: 'PK', brh: 'PK', hno: 'PK', bgn: 'PK', hnd: 'PK', tg_arab: 'PK', gju: 'PK', bft: 'PK', kvx: 'PK', khw: 'PK', mvy: 'PK', kxp: 'PK', gjk: 'PK', trw: 'PK', btv: 'PK', gn: 'PY', th: 'TH', thai: 'TH', // script tts: 'TH', nod: 'TH', sou: 'TH', mfa: 'TH', kxm: 'TH', kdt: 'TH', lwl: 'TH', zh_hant: 'TW', hant: 'TW', // script trv: 'TW', nv: 'US', pdc: 'US', haw: 'US', frc: 'US', chr: 'US', esu: 'US', dak: 'US', cho: 'US', lkt: 'US', ik: 'US', mus: 'US', sm: 'WS', zu: 'ZA', xh: 'ZA', af: 'ZA', nso: 'ZA', ts: 'ZA', ve: 'ZA', nr: 'ZA', sn: 'ZW', nd: 'ZW', mxc: 'ZW', kck: 'ZW', haz: 'AF', uz_arab: 'AF', prd: 'AF', arq: 'DZ', kab: 'DZ', ar: 'EG', arab: 'EG', // script arz: 'EG', ckb: 'IQ', syr: 'IQ', fa: 'IR', az_arab: 'IR', mzn: 'IR', glk: 'IR', sdh: 'IR', lrc: 'IR', rmt: 'IR', bqi: 'IR', luz: 'IR', lki: 'IR', gbz: 'IR', bej: 'SD', fvr: 'SD', mls: 'SD', fia: 'SD', zag: 'SD', dv: 'MV', thaa: 'MV' // script }; /* eslint-enable camelcase */ export default langRegionMap; × Search results Close "},"langRegionMap.js.html":{"id":"langRegionMap.js.html","title":"Source: langRegionMap.js","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Source: langRegionMap.js /** * Contains base mapping of language code to country code. * Contains data only for countries which first day of week is not monday, * and mainly for languages approximately having more than 10 mln speakers. * * Based on data from `fullLangRegionMap.js`. * * @module langRegionMap */ /* eslint-disable camelcase */ /** * Base mapping of language code to country code. * Contains data only for countries which first day of week is not monday, * and mainly for languages approximately having more than 10 mln speakers. * * Based on data from `fullLangRegionMap.js`. */ const langRegionMap = { en: 'US', hi: 'IN', deva: 'IN', // script te: 'IN', mr: 'IN', ta: 'IN', gu: 'IN', kn: 'IN', or: 'IN', ml: 'IN', pa: 'IN', bho: 'IN', awa: 'IN', as: 'IN', mwr: 'IN', mai: 'IN', mag: 'IN', bgc: 'IN', hne: 'IN', dcc: 'IN', bn: 'BD', beng: 'BD', // script rkt: 'BD', dz: 'BT', tibt: 'BT', // script tn: 'BW', am: 'ET', ethi: 'ET', // script om: 'ET', quc: 'GT', id: 'ID', jv: 'ID', su: 'ID', mad: 'ID', ms_arab: 'ID', he: 'IL', hebr: 'IL', // script jam: 'JM', ja: 'JP', jpan: 'JP', // script km: 'KH', khmr: 'KH', // script ko: 'KR', kore: 'KR', // script lo: 'LA', laoo: 'LA', // script mh: 'MH', my: 'MM', mymr: 'MM', // script mt: 'MT', ne: 'NP', fil: 'PH', ceb: 'PH', ilo: 'PH', ur: 'PK', pa_arab: 'PK', lah: 'PK', ps: 'PK', sd: 'PK', skr: 'PK', gn: 'PY', th: 'TH', thai: 'TH', // script tts: 'TH', zh_hant: 'TW', hant: 'TW', // script sm: 'WS', zu: 'ZA', sn: 'ZW', arq: 'DZ', ar: 'EG', arab: 'EG', // script arz: 'EG', fa: 'IR', az_arab: 'IR', dv: 'MV', thaa: 'MV' // script }; /* eslint-enable camelcase */ export default langRegionMap; × Search results Close "},"main.js.html":{"id":"main.js.html","title":"Source: main.js","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Source: main.js /* * weekstart * https://github.com/gamtiq/weekstart */ /** * Library to get first day of week. * * Uses data from {@link module:langRegionMap langRegionMap.js} and * {@link module:regionDayMap regionDayMap.js}. * * @module main */ import * as api from './api'; import langRegionMap from './langRegionMap'; import regionDayMap from './regionDayMap'; /** * Return first day of week for country/region code. * * Based on data from: * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html) * - [https://www.iso.org/iso-3166-country-codes.html](https://www.iso.org/iso-3166-country-codes.html) * * @example * getWeekStartByRegion('PNG'); // 1 * getWeekStartByRegion('qa'); // 6 * getWeekStartByRegion(462); // 5 * * @param {number | string} regionCode * ISO 3166 Alpha-2, Alpha-3 or numeric code. * @return {number} * Code of first day of week for the given country/region code: * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. * @alias module:main.getWeekStartByRegion * @see module:api.getWeekStartByRegion */ export function getWeekStartByRegion(regionCode) { return api.getWeekStartByRegion(regionCode, regionDayMap); } /** * Return first day of week for locale identifier. * * Based on data from: * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html) * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html) * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html) * - [http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers](http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers) * * @example * getWeekStartByLocale('no'); // 1 * getWeekStartByLocale('Pa_Guru'); // 0 * getWeekStartByLocale('fr-DZ'); // 6 * * @param {string} locale * Locale identifier. * @return {number} * Code of first day of week for the given locale identifier: * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. * @alias module:main.getWeekStartByLocale * @see module:api.getWeekStartByLocale */ export function getWeekStartByLocale(locale) { return api.getWeekStartByLocale(locale, langRegionMap, regionDayMap); } × Search results Close "},"regionDayMap.js.html":{"id":"regionDayMap.js.html","title":"Source: regionDayMap.js","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Source: regionDayMap.js /** * Contains data about first day of week depending on country code. * * @module regionDayMap */ /* eslint quote-props: ['error', 'as-needed', {'keywords': true, 'numbers': false, 'unnecessary': false}] */ /** * Data about first day of week depending on country code. * Based on: * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html) * - [https://www.iso.org/iso-3166-country-codes.html](https://www.iso.org/iso-3166-country-codes.html) */ const regionDayMap = { // Sunday AG: 0, ATG: 0, 28: 0, AS: 0, ASM: 0, 16: 0, BD: 0, BGD: 0, 50: 0, BR: 0, BRA: 0, 76: 0, BS: 0, BHS: 0, 44: 0, BT: 0, BTN: 0, 64: 0, BW: 0, BWA: 0, 72: 0, BZ: 0, BLZ: 0, 84: 0, CA: 0, CAN: 0, 124: 0, CO: 0, COL: 0, 170: 0, DM: 0, DMA: 0, 212: 0, DO: 0, DOM: 0, 214: 0, ET: 0, ETH: 0, 231: 0, GT: 0, GTM: 0, 320: 0, GU: 0, GUM: 0, 316: 0, HK: 0, HKG: 0, 344: 0, HN: 0, HND: 0, 340: 0, ID: 0, IDN: 0, 360: 0, IL: 0, ISR: 0, 376: 0, IN: 0, IND: 0, 356: 0, JM: 0, JAM: 0, 388: 0, JP: 0, JPN: 0, 392: 0, KE: 0, KEN: 0, 404: 0, KH: 0, KHM: 0, 116: 0, KR: 0, KOR: 0, 410: 0, LA: 0, LA0: 0, 418: 0, MH: 0, MHL: 0, 584: 0, MM: 0, MMR: 0, 104: 0, MO: 0, MAC: 0, 446: 0, MT: 0, MLT: 0, 470: 0, MX: 0, MEX: 0, 484: 0, MZ: 0, MOZ: 0, 508: 0, NI: 0, NIC: 0, 558: 0, NP: 0, NPL: 0, 524: 0, PA: 0, PAN: 0, 591: 0, PE: 0, PER: 0, 604: 0, PH: 0, PHL: 0, 608: 0, PK: 0, PAK: 0, 586: 0, PR: 0, PRI: 0, 630: 0, PT: 0, PRT: 0, 620: 0, PY: 0, PRY: 0, 600: 0, SA: 0, SAU: 0, 682: 0, SG: 0, SGP: 0, 702: 0, SV: 0, SLV: 0, 222: 0, TH: 0, THA: 0, 764: 0, TT: 0, TTO: 0, 780: 0, TW: 0, TWN: 0, 158: 0, UM: 0, UMI: 0, 581: 0, US: 0, USA: 0, 840: 0, VE: 0, VEN: 0, 862: 0, VI: 0, VIR: 0, 850: 0, WS: 0, WSM: 0, 882: 0, YE: 0, YEM: 0, 887: 0, ZA: 0, ZAF: 0, 710: 0, ZW: 0, ZWE: 0, 716: 0, // Saturday AE: 6, ARE: 6, 784: 6, AF: 6, AFG: 6, 4: 6, BH: 6, BHR: 6, 48: 6, DJ: 6, DJI: 6, 262: 6, DZ: 6, DZA: 6, 12: 6, EG: 6, EGY: 6, 818: 6, IQ: 6, IRQ: 6, 368: 6, IR: 6, IRN: 6, 364: 6, JO: 6, JOR: 6, 400: 6, KW: 6, KWT: 6, 414: 6, LY: 6, LBY: 6, 434: 6, OM: 6, OMN: 6, 512: 6, QA: 6, QAT: 6, 634: 6, SD: 6, SDN: 6, 729: 6, SY: 6, SYR: 6, 760: 6, // Friday MV: 5, MDV: 5, 462: 5 // Else - Monday }; export default regionDayMap; × Search results Close "},"modules.list.html":{"id":"modules.list.html","title":"Modules","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Modules × Search results Close "},"index.html":{"id":"index.html","title":"Index","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap weekstart Library to get first day of week. getWeekStartByRegion('MAC'); // 0 getWeekStartByLocale('arq'); // 6The library is based on the following data from Unicode (especially from Common Locale Data Repository) and from ISO: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/supplemental/weekData.json https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/scripts_languages_and_territories.html http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers https://www.iso.org/iso-3166-country-codes.html There are 2 variants of the library having identical API: main - uses base mapping of language code to country code from langRegionMap. full - uses full mapping of language code to country code from fullLangRegionMap. langRegionMap contains only main language codes. It is data subset from fullLangRegionMap. Table of contents Installation Usage Examples API Contributing License Installation ↑Nodenpm install weekstartBowerbower install weekstartAMD/UMD, <script>Use dist/main.js or dist/min/main.js (minified version). Use dist/full.js or dist/min/full.js (minified version) when you need full locale data. Usage ↑ECMAScript 6import {getWeekStartByLocale, getWeekStartByRegion} from 'weekstart';If you need full data: import {getWeekStartByLocale, getWeekStartByRegion} from 'weekstart/full';Nodeconst getWeekStartByLocale = require('weekstart').getWeekStartByLocale; const getWeekStartByRegion = require('weekstart').getWeekStartByRegion;If you need full data: const getWeekStartByLocale = require('weekstart/full').getWeekStartByLocale; const getWeekStartByRegion = require('weekstart/full').getWeekStartByRegion;AMD/UMDdefine(['path/to/dist/main.js'], function(weekstart) { const getWeekStartByLocale = weekstart.getWeekStartByLocale; const getWeekStartByRegion = weekstart.getWeekStartByRegion; });If you need full data: define(['path/to/dist/full.js'], function(weekstart) { const getWeekStartByLocale = weekstart.getWeekStartByLocale; const getWeekStartByRegion = weekstart.getWeekStartByRegion; });Bower, <script><!-- Use bower_components/weekstart/dist/main.js and bower_components/weekstart/dist/full.js if the library was installed by Bower --> <script type=\"text/javascript\" src=\"path/to/dist/main.js\"></script> <script type=\"text/javascript\"> // weekstart is available via weekstart field of window object const getWeekStartByLocale = weekstart.getWeekStartByLocale; const getWeekStartByRegion = weekstart.getWeekStartByRegion; </script>If you need full data use path/to/dist/full.js instead of path/to/dist/main.js. Examples ↑getWeekStartByRegion('dj'); // 6 getWeekStartByRegion('No'); // 1 getWeekStartByRegion('CAN'); // 0 getWeekStartByRegion(462); // 5 getWeekStartByLocale('Jam'); // 0 getWeekStartByLocale('Fa'); // 6 getWeekStartByLocale('vi'); // 1 getWeekStartByLocale('es_MX'); // 0 getWeekStartByLocale('az-Arab-IRN'); // 6In the following examples results are given for the function from full.js. The same calls for the function from main.js will return 1. getWeekStartByLocale('CCP'); // 0 getWeekStartByLocale('UZ-arab'); // 6API ↑getWeekStartByLocale(locale): numberReturn first day of week for locale identifier: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. getWeekStartByRegion(regionCode): numberReturn first day of week for country/region code: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. See docs for details. Contributing ↑In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code. License ↑Licensed under the MIT license. × Search results Close "},"module-api.html":{"id":"module-api.html","title":"Module: api","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Module: api Functions to get first day of week. Source: api.js, line 1 Methods <static> getWeekStartByLocale(locale, langRegionMap, regionDayMap) Return first day of week for locale identifier. Parameters: Name Type Description locale string Locale identifier. langRegionMap object Mapping of language code to country/region code that should be used to get result. Language codes should be in lower case. regionDayMap object Mapping of country/region code to first day of week that should be used to get result. Country codes should be in upper case. Source: api.js, line 61 Returns: Code of first day of week for the given locale identifier: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. Type number Example getWeekStartByLocale('no', {}, {}); // 1 getWeekStartByLocale('no', {no: 'abc'}, {ABC: 3}); // 3 getWeekStartByLocale('KK_arab', {kk_arab: 'CN'}, {CN: 0}); // 0 getWeekStartByLocale('fr-DZ', {fr: 'FR'}, {FR: 1, DZ: 6}); // 6 <static> getWeekStartByRegion(regionCode, regionDayMap) Return first day of week for country/region code. Parameters: Name Type Description regionCode number | string ISO 3166 Alpha-2, Alpha-3 or numeric code. regionDayMap object Mapping of country/region code to first day of week that should be used to get result. Country codes should be in upper case. Source: api.js, line 27 Returns: Code of first day of week for the given country/region code: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. Type number Example getWeekStartByRegion('PNG', {}); // 1 getWeekStartByRegion('png', {BR: 0, PNG: 3, EG: 6}); // 3 getWeekStartByRegion('qa', {QA: 6}); // 6 getWeekStartByRegion(50, {BD: 5, 50: 5, SD: 6}); // 5 × Search results Close "},"module-full.html":{"id":"module-full.html","title":"Module: full","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Module: full Library to get first day of week. Uses data from fullLangRegionMap.js and regionDayMap.js. Source: full.js, line 6 Methods <static> getWeekStartByLocale(locale) Return first day of week for locale identifier. Based on data from: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers Parameters: Name Type Description locale string Locale identifier. Source: full.js, line 65 See: module:api.getWeekStartByLocale Returns: Code of first day of week for the given locale identifier: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. Type number Example getWeekStartByLocale('no'); // 1 getWeekStartByLocale('PA_arab'); // 0 getWeekStartByLocale('fr-DZ'); // 6 <static> getWeekStartByRegion(regionCode) Return first day of week for country/region code. Based on data from: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html https://www.iso.org/iso-3166-country-codes.html Parameters: Name Type Description regionCode number | string ISO 3166 Alpha-2, Alpha-3 or numeric code. Source: full.js, line 39 See: module:api.getWeekStartByRegion Returns: Code of first day of week for the given country/region code: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. Type number Example getWeekStartByRegion('PNG'); // 1 getWeekStartByRegion('qa'); // 6 getWeekStartByRegion(462); // 5 × Search results Close "},"module-fullLangRegionMap.html":{"id":"module-fullLangRegionMap.html","title":"Module: fullLangRegionMap","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Module: fullLangRegionMap Contains full mapping of language code to country code. Data only for countries which first day of week is not monday. Source: fullLangRegionMap.js, line 1 Members <inner, constant> langRegionMap Full mapping of language code to country code. Contains data only for countries which first day of week is not monday. Based on: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/scripts_languages_and_territories.html Source: fullLangRegionMap.js, line 19 × Search results Close "},"module-langRegionMap.html":{"id":"module-langRegionMap.html","title":"Module: langRegionMap","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Module: langRegionMap Contains base mapping of language code to country code. Contains data only for countries which first day of week is not monday, and mainly for languages approximately having more than 10 mln speakers. Based on data from fullLangRegionMap.js. Source: langRegionMap.js, line 1 Members <inner, constant> langRegionMap Base mapping of language code to country code. Contains data only for countries which first day of week is not monday, and mainly for languages approximately having more than 10 mln speakers. Based on data from fullLangRegionMap.js. Source: langRegionMap.js, line 20 × Search results Close "},"module-main.html":{"id":"module-main.html","title":"Module: main","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Module: main Library to get first day of week. Uses data from langRegionMap.js and regionDayMap.js. Source: main.js, line 6 Methods <static> getWeekStartByLocale(locale) Return first day of week for locale identifier. Based on data from: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers Parameters: Name Type Description locale string Locale identifier. Source: main.js, line 65 See: module:api.getWeekStartByLocale Returns: Code of first day of week for the given locale identifier: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. Type number Example getWeekStartByLocale('no'); // 1 getWeekStartByLocale('Pa_Guru'); // 0 getWeekStartByLocale('fr-DZ'); // 6 <static> getWeekStartByRegion(regionCode) Return first day of week for country/region code. Based on data from: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html https://www.iso.org/iso-3166-country-codes.html Parameters: Name Type Description regionCode number | string ISO 3166 Alpha-2, Alpha-3 or numeric code. Source: main.js, line 39 See: module:api.getWeekStartByRegion Returns: Code of first day of week for the given country/region code: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday. Type number Example getWeekStartByRegion('PNG'); // 1 getWeekStartByRegion('qa'); // 6 getWeekStartByRegion(462); // 5 × Search results Close "},"module-regionDayMap.html":{"id":"module-regionDayMap.html","title":"Module: regionDayMap","body":" weekstart Modules apifullfullLangRegionMaplangRegionMapmainregionDayMap Module: regionDayMap Contains data about first day of week depending on country code. Source: regionDayMap.js, line 1 Members <inner, constant> regionDayMap Data about first day of week depending on country code. Based on: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html https://www.iso.org/iso-3166-country-codes.html Source: regionDayMap.js, line 15 × Search results Close "}}
</script>
<script type="text/javascript">
$(document).ready(function() {
Searcher.init();
});
$(window).on("message", function(msg) {
var msgData = msg.originalEvent.data;
if (msgData.msgid != "docstrap.quicksearch.start") {
return;
}
var results = Searcher.search(msgData.searchTerms);
window.parent.postMessage({"results": results, "msgid": "docstrap.quicksearch.done"}, "*");
});
</script>
</body>
</html>