cldr-smart-quotes 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,6 +27,9 @@ smartQuotes(`"She said 'hi'"`, "de");
27
27
  // "„She said ‚hi‘“"
28
28
  ```
29
29
 
30
+ The default export is `smartQuotes`, with every export as a property:
31
+ `import smartQuotes from "cldr-smart-quotes"`.
32
+
30
33
  ## API
31
34
 
32
35
  ### `getQuotes(locale)`
package/index.d.mts CHANGED
@@ -23,7 +23,7 @@ export declare function quote(text: string, locale: string | Intl.Locale, { alte
23
23
  * @returns {string}
24
24
  */
25
25
  export declare function smartQuotes(text: string, locale: string | Intl.Locale): string;
26
- declare const _default: {
26
+ declare const _default: typeof smartQuotes & {
27
27
  getQuotes: typeof getQuotes;
28
28
  quote: typeof quote;
29
29
  smartQuotes: typeof smartQuotes;
package/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! cldr-smart-quotes | MIT License | Includes data © Unicode, Inc., Unicode License v3 (https://www.unicode.org/license.txt) */
2
- function e(e){if(typeof e!=`string`)throw TypeError(`Input must be a string`)}const t=/* @__PURE__ */ new Map;function n(e){if(typeof e!=`string`)return new Intl.Locale(e).baseName;let n=t.get(e);return n===void 0&&(t.size>=1e3&&t.clear(),n=new Intl.Locale(e).baseName,t.set(e,n)),n}function r(e,t){let r=n(t);for(;!e.locales.has(r);){let t=r.lastIndexOf(`-`);r=e.aliases.get(r)??(t===-1?`und`:r.slice(0,t))}return r}function i(e,t){return e.values[e.locales.get(r(e,t))]}const a={values:[[`«`,`»`,`‘`,`’`],[`“`,`”`,`‘`,`’`],[`„`,`”`,`‚`,`’`],[`«`,`»`,`‹`,`›`],[`”`,`“`,`’`,`‘`],[`«`,`»`,`“`,`”`],[`«`,`»`,`„`,`“`],[`„`,`“`,`„`,`“`],[`„`,`“`,`‚`,`‘`],[`„`,`”`,`‘`,`’`],[`“`,`”`,`«`,`»`],[`”`,`”`,`’`,`’`],[`«`,`»`,`«`,`»`],[`«`,`»`,`”`,`“`],[`‘`,`’`,`“`,`”`],[`„`,`”`,`»`,`«`],[`「`,`」`,`『`,`』`],[`„`,`“`,`«`,`»`],[`»`,`«`,`›`,`‹`],[`‘`,`’`,`‘`,`’`],[`„`,`”`,`«`,`»`],[`«`,`»`,`„`,`”`],[`„`,`”`,`’`,`’`],[`“`,`’`,`“`,`”`],[`“`,`”`,`“`,`”`],[`“`,`”`,`’`,`‘`]],locales:/* @__PURE__ */ new Map([[`und`,1],[`ady`,0],[`agq`,2],[`am`,3],[`ar`,4],[`ast`,5],[`bas`,6],[`be`,6],[`bg`,7],[`blo`,5],[`bm`,5],[`br`,5],[`bs`,9],[`bua`,6],[`ca`,5],[`cs`,8],[`cv`,5],[`de`,8],[`dsb`,8],[`dua`,0],[`dyo`,5],[`el`,5],[`eo`,10],[`et`,8],[`eu`,5],[`ewo`,5],[`fa`,3],[`ff`,2],[`fi`,11],[`fr`,12],[`fur`,14],[`gsw`,3],[`he`,11],[`hr`,8],[`hsb`,8],[`hu`,15],[`hy`,12],[`ia`,14],[`ie`,5],[`is`,8],[`it`,5],[`ja`,16],[`jgo`,3],[`ka`,17],[`kab`,5],[`kbd`,0],[`kk`,5],[`kkj`,3],[`ksf`,0],[`ksh`,8],[`ky`,6],[`lag`,11],[`lb`,8],[`lij`,5],[`lld`,4],[`lt`,7],[`luy`,8],[`mg`,5],[`mk`,8],[`mua`,5],[`mzn`,3],[`nb`,0],[`nds`,8],[`nl`,19],[`nmg`,20],[`nn`,0],[`nnh`,5],[`no`,0],[`oc`,12],[`os`,6],[`pl`,20],[`pms`,5],[`prg`,7],[`rm`,3],[`rn`,11],[`ro`,20],[`ru`,6],[`rw`,0],[`sah`,6],[`sc`,5],[`se`,11],[`sg`,5],[`shi`,21],[`sk`,8],[`sl`,8],[`sn`,11],[`sr`,22],[`st`,23],[`sv`,11],[`syr`,4],[`szl`,15],[`ti`,5],[`tk`,24],[`tn`,24],[`tyv`,6],[`ug`,18],[`uk`,6],[`ur`,4],[`uz`,25],[`wae`,3],[`yav`,12],[`yi`,11],[`yue`,16],[`zgh`,21],[`az-Cyrl`,3],[`bs-Cyrl`,8],[`el-polyton`,0],[`es-US`,5],[`ff-Adlm`,1],[`fr-CA`,13],[`fr-CH`,3],[`kk-Arab`,18],[`pt-AO`,5],[`pt-CH`,5],[`pt-CV`,5],[`pt-GQ`,5],[`pt-GW`,5],[`pt-LU`,5],[`pt-MO`,5],[`pt-MZ`,5],[`pt-PT`,5],[`pt-ST`,5],[`pt-TL`,5],[`ti-ER`,14],[`uz-Arab`,1],[`uz-Cyrl`,1],[`zh-Hant`,16]]),aliases:/* @__PURE__ */ new Map([[`az-RU`,`az-Cyrl-RU`],[`kk-AF`,`kk-Arab-AF`],[`kk-CN`,`kk-Arab-CN`],[`kk-IR`,`kk-Arab-IR`],[`kk-MN`,`kk-Arab-MN`],[`uz-AF`,`uz-Arab-AF`],[`uz-CN`,`uz-Cyrl-CN`],[`zh-AU`,`zh-Hant-AU`],[`zh-BN`,`zh-Hant-BN`],[`zh-GB`,`zh-Hant-GB`],[`zh-GF`,`zh-Hant-GF`],[`zh-HK`,`zh-Hant-HK`],[`zh-ID`,`zh-Hant-ID`],[`zh-MO`,`zh-Hant-MO`],[`zh-PA`,`zh-Hant-PA`],[`zh-PF`,`zh-Hant-PF`],[`zh-PH`,`zh-Hant-PH`],[`zh-SR`,`zh-Hant-SR`],[`zh-TH`,`zh-Hant-TH`],[`zh-TW`,`zh-Hant-TW`],[`zh-US`,`zh-Hant-US`],[`zh-VN`,`zh-Hant-VN`]])},o=`49.0.0`,s=/[\p{L}\p{N}\p{M}]/u,c=/[\s\p{Ps}\p{Pi}\p{Pd}]/u,l=/\s/u,u=/\p{Nd}/u;function d(e){let[t,n,r,o]=i(a,e);return{start:t,end:n,alternateStart:r,alternateEnd:o}}function f(t,n,{alternate:r=!1}={}){e(t);let[o,s,c,l]=i(a,n);return r?c+t+l:o+t+s}function p(t,n){e(t);let[r,o,u,d]=i(a,n),f=Array.from(t),p=``,h=0,g=!1;for(let e=0;e<f.length;e++){let t=f[e];if(t!==`"`&&t!==`'`){p+=t,g=!1;continue}let n=f[e-1],i=f[e+1],a=(n===void 0||g||c.test(n))&&i!==void 0&&!l.test(i),_,v=!1;t===`"`?(_=a?r:o,v=a):a&&m(f,e)?_=`’`:a?(_=u,v=!0,h++):s.test(n)&&i!==void 0&&s.test(i)?_=`’`:h>0?(_=d,h--):_=`’`,p+=_,g=v}return p}function m(e,t){return u.test(e[t+1]??``)&&u.test(e[t+2]??``)&&!u.test(e[t+3]??``)}var h={getQuotes:d,quote:f,smartQuotes:p,VERSION:o};export{o as VERSION,h as default,d as getQuotes,f as quote,p as smartQuotes};
2
+ function e(e){if(typeof e!=`string`)throw TypeError(`Input must be a string`)}const t=/* @__PURE__ */ new Map;function n(e){if(typeof e!=`string`)return new Intl.Locale(e).baseName;let n=t.get(e);return n===void 0&&(t.size>=1e3&&t.clear(),n=new Intl.Locale(e).baseName,t.set(e,n)),n}function r(e,t){let r=n(t);for(;!e.locales.has(r);){let t=r.lastIndexOf(`-`);r=e.aliases.get(r)??(t===-1?`und`:r.slice(0,t))}return r}function i(e,t){return e.values[e.locales.get(r(e,t))]}const a={values:[[`«`,`»`,`‘`,`’`],[`“`,`”`,`‘`,`’`],[`„`,`”`,`‚`,`’`],[`«`,`»`,`‹`,`›`],[`”`,`“`,`’`,`‘`],[`«`,`»`,`“`,`”`],[`«`,`»`,`„`,`“`],[`„`,`“`,`„`,`“`],[`„`,`“`,`‚`,`‘`],[`„`,`”`,`‘`,`’`],[`“`,`”`,`«`,`»`],[`”`,`”`,`’`,`’`],[`«`,`»`,`«`,`»`],[`«`,`»`,`”`,`“`],[`‘`,`’`,`“`,`”`],[`„`,`”`,`»`,`«`],[`「`,`」`,`『`,`』`],[`„`,`“`,`«`,`»`],[`»`,`«`,`›`,`‹`],[`‘`,`’`,`‘`,`’`],[`„`,`”`,`«`,`»`],[`«`,`»`,`„`,`”`],[`„`,`”`,`’`,`’`],[`“`,`’`,`“`,`”`],[`“`,`”`,`“`,`”`],[`“`,`”`,`’`,`‘`]],locales:/* @__PURE__ */ new Map([[`und`,1],[`ady`,0],[`agq`,2],[`am`,3],[`ar`,4],[`ast`,5],[`bas`,6],[`be`,6],[`bg`,7],[`blo`,5],[`bm`,5],[`br`,5],[`bs`,9],[`bua`,6],[`ca`,5],[`cs`,8],[`cv`,5],[`de`,8],[`dsb`,8],[`dua`,0],[`dyo`,5],[`el`,5],[`eo`,10],[`et`,8],[`eu`,5],[`ewo`,5],[`fa`,3],[`ff`,2],[`fi`,11],[`fr`,12],[`fur`,14],[`gsw`,3],[`he`,11],[`hr`,8],[`hsb`,8],[`hu`,15],[`hy`,12],[`ia`,14],[`ie`,5],[`is`,8],[`it`,5],[`ja`,16],[`jgo`,3],[`ka`,17],[`kab`,5],[`kbd`,0],[`kk`,5],[`kkj`,3],[`ksf`,0],[`ksh`,8],[`ky`,6],[`lag`,11],[`lb`,8],[`lij`,5],[`lld`,4],[`lt`,7],[`luy`,8],[`mg`,5],[`mk`,8],[`mua`,5],[`mzn`,3],[`nb`,0],[`nds`,8],[`nl`,19],[`nmg`,20],[`nn`,0],[`nnh`,5],[`no`,0],[`oc`,12],[`os`,6],[`pl`,20],[`pms`,5],[`prg`,7],[`rm`,3],[`rn`,11],[`ro`,20],[`ru`,6],[`rw`,0],[`sah`,6],[`sc`,5],[`se`,11],[`sg`,5],[`shi`,21],[`sk`,8],[`sl`,8],[`sn`,11],[`sr`,22],[`st`,23],[`sv`,11],[`syr`,4],[`szl`,15],[`ti`,5],[`tk`,24],[`tn`,24],[`tyv`,6],[`ug`,18],[`uk`,6],[`ur`,4],[`uz`,25],[`wae`,3],[`yav`,12],[`yi`,11],[`yue`,16],[`zgh`,21],[`az-Cyrl`,3],[`bs-Cyrl`,8],[`el-polyton`,0],[`es-US`,5],[`ff-Adlm`,1],[`fr-CA`,13],[`fr-CH`,3],[`kk-Arab`,18],[`pt-AO`,5],[`pt-CH`,5],[`pt-CV`,5],[`pt-GQ`,5],[`pt-GW`,5],[`pt-LU`,5],[`pt-MO`,5],[`pt-MZ`,5],[`pt-PT`,5],[`pt-ST`,5],[`pt-TL`,5],[`ti-ER`,14],[`uz-Arab`,1],[`uz-Cyrl`,1],[`zh-Hant`,16]]),aliases:/* @__PURE__ */ new Map([[`az-RU`,`az-Cyrl-RU`],[`kk-AF`,`kk-Arab-AF`],[`kk-CN`,`kk-Arab-CN`],[`kk-IR`,`kk-Arab-IR`],[`kk-MN`,`kk-Arab-MN`],[`uz-AF`,`uz-Arab-AF`],[`uz-CN`,`uz-Cyrl-CN`],[`zh-AU`,`zh-Hant-AU`],[`zh-BN`,`zh-Hant-BN`],[`zh-GB`,`zh-Hant-GB`],[`zh-GF`,`zh-Hant-GF`],[`zh-HK`,`zh-Hant-HK`],[`zh-ID`,`zh-Hant-ID`],[`zh-MO`,`zh-Hant-MO`],[`zh-PA`,`zh-Hant-PA`],[`zh-PF`,`zh-Hant-PF`],[`zh-PH`,`zh-Hant-PH`],[`zh-SR`,`zh-Hant-SR`],[`zh-TH`,`zh-Hant-TH`],[`zh-TW`,`zh-Hant-TW`],[`zh-US`,`zh-Hant-US`],[`zh-VN`,`zh-Hant-VN`]])},o=`49.0.0`,s=/[\p{L}\p{N}\p{M}]/u,c=/[\s\p{Ps}\p{Pi}\p{Pd}]/u,l=/\s/u,u=/\p{Nd}/u;function d(e){let[t,n,r,o]=i(a,e);return{start:t,end:n,alternateStart:r,alternateEnd:o}}function f(t,n,{alternate:r=!1}={}){e(t);let[o,s,c,l]=i(a,n);return r?c+t+l:o+t+s}function p(t,n){e(t);let[r,o,u,d]=i(a,n),f=Array.from(t),p=``,h=0,g=!1;for(let e=0;e<f.length;e++){let t=f[e];if(t!==`"`&&t!==`'`){p+=t,g=!1;continue}let n=f[e-1],i=f[e+1],a=(n===void 0||g||c.test(n))&&i!==void 0&&!l.test(i),_,v=!1;t===`"`?(_=a?r:o,v=a):a&&m(f,e)?_=`’`:a?(_=u,v=!0,h++):s.test(n)&&i!==void 0&&s.test(i)?_=`’`:h>0?(_=d,h--):_=`’`,p+=_,g=v}return p}function m(e,t){return u.test(e[t+1]??``)&&u.test(e[t+2]??``)&&!u.test(e[t+3]??``)}var h=/* @__PURE__ */ Object.assign(p,{getQuotes:d,quote:f,smartQuotes:p,VERSION:o});export{o as VERSION,h as default,d as getQuotes,f as quote,p as smartQuotes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cldr-smart-quotes",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Locale-correct quotation marks and smart quotes, based on the Unicode CLDR",
5
5
  "keywords": [
6
6
  "unicode",