New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alfalab/utils

Package Overview
Dependencies
Maintainers
16
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.3.0 to 1.4.0

4

dist/index.d.ts

@@ -230,3 +230,7 @@ // Generated by dts-bundle-generator v5.8.0

export declare const splitAmount: (amount: string, partSize: number | undefined, splitter: string, splitFrom?: number) => string;
/**
* Возвращает true/false при проверке номера валидности карты по алгоритму Луна
*/
export declare const isValidCardNumber: (setValue: string) => boolean;
export {};

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@alfalab/data");var t=/^(\d{5})(\d{3})(\d)(\d{4})(\d{7})$/;var e=function(t){return r.currency.CURRENCY_SYMBOLS[t]},n=function(r,t,e,n){void 0===t&&(t=3),void 0===n&&(n=5);var o="\\B(?=(\\d{"+t+"})+(?!\\d))";return r.length<n?r:r.replace(new RegExp(o,"g"),e)},o=String.fromCharCode(8201),u=["B","KB","MB","GB"],a=function(r){return r.replace(/\D+/g,"")};var i={format:function(r){var t=a(r).replace(/(\d)(\d{3})(\d{3})(\d{2})(\d{2})/,"$1 $2 $3-$4-$5");return"7"===t[0]?"+".concat(t):t},getRaw:a,mask:function(r){return r.substr(0,2)+" ··· ··· "+r.substr(r.length-5,r.length)}};var c=function(r){r[0];var t=r[1],e=r[2],n=r[3],o=r[4],u=r[5];return{name:t,iso2:e,dialCode:n,priority:o,areaCodes:null!=u?u:null}};function s(r,t){return void 0===t?r:(r+t).slice(-r.length)}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(t,"$1 $2 $3 $4 $5"):""},exports.formatAmount=function(r){var t=r.value,u=r.currency,a=r.minority,i=r.view;if(null===t)return{majorPart:"",minorPart:"",formatted:"",currencySymbol:e(u),formattedWithCurrency:o+e(u)};a=0===a?1:a;var c=Math.log(a)*Math.LOG10E,s=(Math.abs(t)/a).toFixed(c),l=s.split(".")[0],f=s.split(".")[1];"default"===i&&t%a==0&&(f="");var d=n(l,3,o,4),m=t<0?"−"+d:d,p=f?m+","+f:m;return{majorPart:m,minorPart:f,currencySymbol:e(u),formatted:p,formattedWithCurrency:p+o+e(u)}},exports.formatFileSize=function(r){for(var t=u.length-1,e=function(r){var t=Number(r);return Number.isNaN(t)?0:t}(r),n=0;e>=1024&&n<t;)e/=1024,n+=1;return function(r,t){return r>99&&t===u.length-1?"99+":""+Number(r.toFixed(2))}(e,n)+" "+u[n]},exports.getAllCurrencyCodes=function(){return Object.keys(r.currency.CURRENCY_SYMBOLS)},exports.getCountries=function(){return r.countries.map(c).sort((function(r,t){return r.name.localeCompare(t.name)}))},exports.getCountriesHash=function(){return r.countries.reduce((function(r,t){return r[t[2]]=c(t),r}),{})},exports.getCurrencySymbol=e,exports.isOverflown=function(r){return r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth},exports.phoneNumber=i,exports.pluralize=function(r,t,e,n){var o=Math.abs(r);return(o%=100)>=5&&o<=20?n:1===(o%=10)?t:o>=2&&o<=4?e:n},exports.secondsToTime=function(r){var t=Math.floor(r/60/60),e=Math.floor(r/60)%60,n=r-3600*t-60*e;return{hours:""+s("00",t),minutes:""+s("00",e),seconds:""+s("00",n)}},exports.splitAmount=n;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@alfalab/data");var t=/^(\d{5})(\d{3})(\d)(\d{4})(\d{7})$/;var e=function(t){return r.currency.CURRENCY_SYMBOLS[t]},n=function(r,t,e,n){void 0===t&&(t=3),void 0===n&&(n=5);var o="\\B(?=(\\d{"+t+"})+(?!\\d))";return r.length<n?r:r.replace(new RegExp(o,"g"),e)},o=String.fromCharCode(8201),u=["B","KB","MB","GB"],a=function(r){return r.replace(/\D+/g,"")};var i={format:function(r){var t=a(r).replace(/(\d)(\d{3})(\d{3})(\d{2})(\d{2})/,"$1 $2 $3-$4-$5");return"7"===t[0]?"+".concat(t):t},getRaw:a,mask:function(r){return r.substr(0,2)+" ··· ··· "+r.substr(r.length-5,r.length)}};var c=function(r){r[0];var t=r[1],e=r[2],n=r[3],o=r[4],u=r[5];return{name:t,iso2:e,dialCode:n,priority:o,areaCodes:null!=u?u:null}};function s(r,t){return void 0===t?r:(r+t).slice(-r.length)}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(t,"$1 $2 $3 $4 $5"):""},exports.formatAmount=function(r){var t=r.value,u=r.currency,a=r.minority,i=r.view;if(null===t)return{majorPart:"",minorPart:"",formatted:"",currencySymbol:e(u),formattedWithCurrency:o+e(u)};a=0===a?1:a;var c=Math.log(a)*Math.LOG10E,s=(Math.abs(t)/a).toFixed(c),l=s.split(".")[0],f=s.split(".")[1];"default"===i&&t%a==0&&(f="");var d=n(l,3,o,4),p=t<0?"−"+d:d,m=f?p+","+f:p;return{majorPart:p,minorPart:f,currencySymbol:e(u),formatted:m,formattedWithCurrency:m+o+e(u)}},exports.formatFileSize=function(r){for(var t=u.length-1,e=function(r){var t=Number(r);return Number.isNaN(t)?0:t}(r),n=0;e>=1024&&n<t;)e/=1024,n+=1;return function(r,t){return r>99&&t===u.length-1?"99+":""+Number(r.toFixed(2))}(e,n)+" "+u[n]},exports.getAllCurrencyCodes=function(){return Object.keys(r.currency.CURRENCY_SYMBOLS)},exports.getCountries=function(){return r.countries.map(c).sort((function(r,t){return r.name.localeCompare(t.name)}))},exports.getCountriesHash=function(){return r.countries.reduce((function(r,t){return r[t[2]]=c(t),r}),{})},exports.getCurrencySymbol=e,exports.isOverflown=function(r){return r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth},exports.isValidCardNumber=function(r){var t=0,e=r.replace(/\D/g,"");if(""===e)return!1;for(var n=0;n<e.length;n++){var o=parseInt(e[n],10);t+=0==n%2&&(o*=2)>9?o-9:o}return t%10==0},exports.phoneNumber=i,exports.pluralize=function(r,t,e,n){var o=Math.abs(r);return(o%=100)>=5&&o<=20?n:1===(o%=10)?t:o>=2&&o<=4?e:n},exports.secondsToTime=function(r){var t=Math.floor(r/60/60),e=Math.floor(r/60)%60,n=r-3600*t-60*e;return{hours:""+s("00",t),minutes:""+s("00",e),seconds:""+s("00",n)}},exports.splitAmount=n;
{
"name": "@alfalab/utils",
"version": "1.3.0",
"version": "1.4.0",
"description": "common utils",

@@ -29,3 +29,3 @@ "main": "dist/index.js",

},
"gitHead": "0c1526ec4823a6e003f58d1d2cfba50c5abcd660"
"gitHead": "831340dfd55d31a824b7e264a0e1a042cac68139"
}

@@ -13,1 +13,5 @@ # Utils

- `isOverflown` - возвращает `true`, если html-элемент переполнен. Необходимо в случаях когда надо определить, есть ли у элемента скроллбар или текст в элементе обрезался (`text-overflow`).
### is-valid-card-number
- `isValidCardNumber` - принимает номер карты и возвращает `true`, если номер карты валидный по алгоритму Луна.
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