@alfalab/utils
Advanced tools
Comparing version 0.2.0 to 0.3.0
// Generated by dts-bundle-generator v5.3.0 | ||
export declare function pluralize(number: number, one: string, two: string, five: string): string; | ||
/** | ||
* Возвращает отформатированное значение счёта. | ||
* Разделяет пробелами число на группы. | ||
* XXXXX XXX X XXXX XXXXXXX | ||
* | ||
* @param value Номер счёта. | ||
*/ | ||
export declare function formatAccount(value: string): string; | ||
declare const CURRENCY_SYMBOLS: { | ||
@@ -160,3 +167,4 @@ ALL: string; | ||
export declare const getCurrencySymbol: (currencyCode: CurrencyCodes) => string; | ||
export declare function pluralize(number: number, one: string, two: string, five: string): string; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@alfalab/data");var e=function(e){return r.currency.CURRENCY_SYMBOLS[e]},t=String.fromCharCode(8201);exports.AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR=",",exports.THINSP=t,exports.formatAmount=function(r){var a=r.value,o=r.currency,n=r.minority,u=r.view;if(null===a)return{majorPart:"",minorPart:"",formated:"",currencySymbol:e(o),formatedWithCurrency:t+e(o)};n=0===n?1:n;var c=Math.log(n)*Math.LOG10E,i=(Math.abs(a)/n).toFixed(c),l=i.split(".")[0],s=i.split(".")[1];"default"===u&&a%n==0&&(s="");var d=function(r,e,t,a){void 0===e&&(e=3),void 0===a&&(a=5);var o="\\B(?=(\\d{"+e+"})+(?!\\d))";return r.length<a?r:r.replace(new RegExp(o,"g"),t)}(l,3,t,4),f=a<0?"−"+d:d,m=s?f+","+s:f;return{majorPart:f,minorPart:s,currencySymbol:e(o),formated:m,formatedWithCurrency:m+t+e(o)}},exports.getAllCurrencyCodes=function(){return Object.keys(r.currency.CURRENCY_SYMBOLS)},exports.getCurrencySymbol=e,exports.pluralize=function(r,e,t,a){var o=Math.abs(r);return(o%=100)>=5&&o<=20?a:1===(o%=10)?e:o>=2&&o<=4?t:a}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@alfalab/data"),e=/^(\d{5})(\d{3})(\d)(\d{4})(\d{7})$/;var t=function(e){return r.currency.CURRENCY_SYMBOLS[e]},o=String.fromCharCode(8201);exports.AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR=",",exports.THINSP=o,exports.formatAccount=function(r){return r?r.replace(e,"$1 $2 $3 $4 $5"):""},exports.formatAmount=function(r){var e=r.value,n=r.currency,a=r.minority,u=r.view;if(null===e)return{majorPart:"",minorPart:"",formated:"",currencySymbol:t(n),formatedWithCurrency:o+t(n)};a=0===a?1:a;var c=Math.log(a)*Math.LOG10E,i=(Math.abs(e)/a).toFixed(c),l=i.split(".")[0],d=i.split(".")[1];"default"===u&&e%a==0&&(d="");var f=function(r,e,t,o){void 0===e&&(e=3),void 0===o&&(o=5);var n="\\B(?=(\\d{"+e+"})+(?!\\d))";return r.length<o?r:r.replace(new RegExp(n,"g"),t)}(l,3,o,4),s=e<0?"−"+f:f,m=d?s+","+d:s;return{majorPart:s,minorPart:d,currencySymbol:t(n),formated:m,formatedWithCurrency:m+o+t(n)}},exports.getAllCurrencyCodes=function(){return Object.keys(r.currency.CURRENCY_SYMBOLS)},exports.getCurrencySymbol=t,exports.pluralize=function(r,e,t,o){var n=Math.abs(r);return(n%=100)>=5&&n<=20?o:1===(n%=10)?e:n>=2&&n<=4?t:o}; |
{ | ||
"name": "@alfalab/utils", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "common utils", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
5282
172