@alfalab/utils
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -52,4 +52,8 @@ // Generated by dts-bundle-generator v5.3.0 | ||
export declare const getCurrencySymbol: (currencyCode: CurrencyCodes) => string; | ||
/** | ||
* Возвращает 4 последние цифры номера счёта в формате `··XXXX` | ||
*/ | ||
export declare function cropAccountNumber(accountNumber: string): 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"),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}; | ||
"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.cropAccountNumber=function(r){return r?"··"+r.slice(-4):r},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 s=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),f=e<0?"−"+s:s,m=d?f+","+d:f;return{majorPart:f,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.4.0", | ||
"version": "0.4.1", | ||
"description": "common utils", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3890
60