Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alfalab/utils

Package Overview
Dependencies
Maintainers
17
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alfalab/utils - npm Package Compare versions

Comparing version 1.10.0 to 1.11.0

16

dist/esm/index.js

@@ -61,3 +61,9 @@ import { currency, countries } from '@alfalab/data';

var AMOUNT_SPLIT_CODE_FROM = 4;
var NEGATIVE_AMOUNT_SYMBOL = '−';
// Reference: https://jkorpela.fi/dashes.html
var NEGATIVE_SYMBOLS = {
/** Unicode: U+2212. An arithmetic operator */
'minus-sign': '−',
/** Unicode: U+002D. The Ascii hyphen. Used in inputs */
'hyphen-minus': '-',
};
var THINSP = String.fromCharCode(8201); //  

@@ -73,3 +79,3 @@ var AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR = ',';

var formatAmount = function (_a) {
var value = _a.value, currency = _a.currency, minority = _a.minority, view = _a.view;
var value = _a.value, currency = _a.currency, minority = _a.minority, view = _a.view, _b = _a.negativeSymbol, negativeSymbol = _b === void 0 ? 'minus-sign' : _b;
var currencySymbol = currency ? getCurrencySymbol(currency) : '';

@@ -90,3 +96,3 @@ if (value === null) {

var majorPart = valueAbsStr.split('.')[0];
var _b = valueAbsStr.split('.'), minorPart = _b[1];
var _c = valueAbsStr.split('.'), minorPart = _c[1];
if (view === 'default' && value % minority === 0) {

@@ -96,3 +102,3 @@ minorPart = '';

var majorPartSplitted = splitAmount(majorPart, AMOUNT_MAJOR_PART_SIZE, THINSP, AMOUNT_SPLIT_CODE_FROM);
var majorPartFormatted = value < 0 ? NEGATIVE_AMOUNT_SYMBOL + majorPartSplitted : majorPartSplitted;
var majorPartFormatted = value < 0 ? NEGATIVE_SYMBOLS[negativeSymbol] + majorPartSplitted : majorPartSplitted;
var formattedValueStr = minorPart

@@ -303,2 +309,2 @@ ? majorPartFormatted + AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR + minorPart

export { AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, THINSP, cropAccountNumber, formatAccount, formatAmount, formatFileSize, getAllCurrencyCodes, getCountries, getCountriesHash, getCurrencySymbol, hasScrolledToBottomOfPage, isOverflown, isValidCardNumber, isValidEmail, phoneNumber, pluralize, secondsToTime, splitAmount };
export { AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, NEGATIVE_SYMBOLS, THINSP, cropAccountNumber, formatAccount, formatAmount, formatFileSize, getAllCurrencyCodes, getCountries, getCountriesHash, getCurrencySymbol, hasScrolledToBottomOfPage, isOverflown, isValidCardNumber, isValidEmail, phoneNumber, pluralize, secondsToTime, splitAmount };

@@ -139,2 +139,9 @@ // Generated by dts-bundle-generator v5.8.0

export declare type CurrencyCodes = keyof typeof CURRENCY_SYMBOLS;
export declare const NEGATIVE_SYMBOLS: {
/** Unicode: U+2212. An arithmetic operator */
"minus-sign": string;
/** Unicode: U+002D. The Ascii hyphen. Used in inputs */
"hyphen-minus": string;
};
export declare type NegativeSymbols = keyof typeof NEGATIVE_SYMBOLS;
export declare const THINSP: string;

@@ -156,3 +163,8 @@ export declare const AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR = ",";

/**
* default - не отображаем копейки, если их значение 0
* default - minus-sign (U+2212).
* Символ минуса, используемый для отображения отрицательных значений
*/
negativeSymbol?: NegativeSymbols;
/**
* default - не отображаем копейки, если их значение 0.
* withZeroMinorPart - отображаем копейки, даже если их значение равно 0

@@ -166,3 +178,3 @@ */

*/
export declare const formatAmount: ({ value, currency, minority, view }: AmountType) => {
export declare const formatAmount: ({ value, currency, minority, view, negativeSymbol, }: AmountType) => {
majorPart: string;

@@ -169,0 +181,0 @@ minorPart: string;

@@ -65,3 +65,9 @@ 'use strict';

var AMOUNT_SPLIT_CODE_FROM = 4;
var NEGATIVE_AMOUNT_SYMBOL = '−';
// Reference: https://jkorpela.fi/dashes.html
var NEGATIVE_SYMBOLS = {
/** Unicode: U+2212. An arithmetic operator */
'minus-sign': '−',
/** Unicode: U+002D. The Ascii hyphen. Used in inputs */
'hyphen-minus': '-',
};
var THINSP = String.fromCharCode(8201); // &thinsp;

@@ -77,3 +83,3 @@ var AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR = ',';

var formatAmount = function (_a) {
var value = _a.value, currency = _a.currency, minority = _a.minority, view = _a.view;
var value = _a.value, currency = _a.currency, minority = _a.minority, view = _a.view, _b = _a.negativeSymbol, negativeSymbol = _b === void 0 ? 'minus-sign' : _b;
var currencySymbol = currency ? getCurrencySymbol(currency) : '';

@@ -94,3 +100,3 @@ if (value === null) {

var majorPart = valueAbsStr.split('.')[0];
var _b = valueAbsStr.split('.'), minorPart = _b[1];
var _c = valueAbsStr.split('.'), minorPart = _c[1];
if (view === 'default' && value % minority === 0) {

@@ -100,3 +106,3 @@ minorPart = '';

var majorPartSplitted = splitAmount(majorPart, AMOUNT_MAJOR_PART_SIZE, THINSP, AMOUNT_SPLIT_CODE_FROM);
var majorPartFormatted = value < 0 ? NEGATIVE_AMOUNT_SYMBOL + majorPartSplitted : majorPartSplitted;
var majorPartFormatted = value < 0 ? NEGATIVE_SYMBOLS[negativeSymbol] + majorPartSplitted : majorPartSplitted;
var formattedValueStr = minorPart

@@ -308,2 +314,3 @@ ? majorPartFormatted + AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR + minorPart

exports.AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR = AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR;
exports.NEGATIVE_SYMBOLS = NEGATIVE_SYMBOLS;
exports.THINSP = THINSP;

@@ -310,0 +317,0 @@ exports.cropAccountNumber = cropAccountNumber;

{
"name": "@alfalab/utils",
"version": "1.10.0",
"version": "1.11.0",
"description": "common utils",

@@ -20,16 +20,15 @@ "sideEffects": false,

"license": "MIT",
"dependencies": {
"@alfalab/data": "^1.2.3",
"fast-redact": "^3.1.1"
},
"devDependencies": {
"@types/fast-redact": "3.0.1",
"dts-bundle-generator": "^5.6.0",
"fast-redact": "^3.1.1",
"rollup": "^2.38.0"
},
"peerDependencies": {
"@alfalab/data": "^1.2.2",
"fast-redact": "^3.1.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "474e5885cfa55b13371f7d4d1f76aaecf4bce631"
"gitHead": "4e9d516fb1d7767a5c72a35410697d117fa30543"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc