Huge News!Announcing our $40M Series B led by Abstract Ventures.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.4.5 to 1.5.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [1.5.0](https://github.com/alfa-laboratory/utils/compare/@alfalab/utils@1.4.5...@alfalab/utils@1.5.0) (2021-10-04)
### Features
* add hasScrolledToBottom util and hook ([#65](https://github.com/alfa-laboratory/utils/issues/65)) ([d5381e3](https://github.com/alfa-laboratory/utils/commit/d5381e324d57227a8b2df62c5c855ddb0dcf9b65))
## [1.4.5](https://github.com/alfa-laboratory/utils/compare/@alfalab/utils@1.4.4...@alfalab/utils@1.4.5) (2021-09-14)

@@ -8,0 +19,0 @@

4

dist/index.d.ts

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

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

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

},
"gitHead": "eb79a57d842f8fcfaad770647e5ceae7c7458dda"
"gitHead": "0f5f9fa3f07e21cf1813b9204ef0b2c5f6a2b27d"
}
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