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.5.1 to 1.6.0

11

CHANGELOG.md

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

# [1.6.0](https://github.com/alfa-laboratory/utils/compare/@alfalab/utils@1.5.1...@alfalab/utils@1.6.0) (2021-11-30)
### Features
* **is-valid-email:** add email validation util ([#67](https://github.com/alfa-laboratory/utils/issues/67)) ([f36cc59](https://github.com/alfa-laboratory/utils/commit/f36cc5909cbe95f2d76d233362f52cdfaba79518))
## [1.5.1](https://github.com/alfa-laboratory/utils/compare/@alfalab/utils@1.5.0...@alfalab/utils@1.5.1) (2021-11-25)

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

@@ -235,2 +235,8 @@ // Generated by dts-bundle-generator v5.8.0

/**
* Возвращает true для валидного email, иначе false
*
* @param email Строка содержащая email
*/
export declare function isValidEmail(email: string): boolean;
/**
* Возвращает TRUE, если проскролено до низа страницы

@@ -237,0 +243,0 @@ */

2

dist/index.js

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

"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=function(r,e){return[r,e].filter(Boolean).join(o)},a=["B","KB","MB","GB"],i=function(r){return r.replace(/\D+/g,"")};var c={format:function(r){var e=i(r).replace(/(\d)(\d{3})(\d{3})(\d{2})(\d{2})/,"$1 $2 $3-$4-$5");return"7"===e[0]?"+".concat(e):e},getRaw:i,mask:function(r){return r.substr(0,2)+" ··· ··· "+r.substr(r.length-5,r.length)}};var l=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,a=r.currency,i=r.minority,c=r.view,l=t(a);if(null===e)return{majorPart:"",minorPart:"",formatted:"",currencySymbol:l,formattedWithCurrency:u(e,l)};i=0===i?1:i;var s=Math.log(i)*Math.LOG10E,f=(Math.abs(e)/i).toFixed(s),d=f.split(".")[0],m=f.split(".")[1];"default"===c&&e%i==0&&(m="");var p=n(d,3,o,4),h=e<0?"−"+p:p,v=m?h+","+m:h;return{majorPart:h,minorPart:m,currencySymbol:l,formatted:v,formattedWithCurrency:u(v,l)}},exports.formatFileSize=function(r){for(var e=a.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===a.length-1?"99+":""+Number(r.toFixed(2))}(t,n)+" "+a[n]},exports.getAllCurrencyCodes=function(){return Object.keys(r.currency.CURRENCY_SYMBOLS)},exports.getCountries=function(){return r.countries.map(l).sort((function(r,e){return r.name.localeCompare(e.name)}))},exports.getCountriesHash=function(){return r.countries.reduce((function(r,e){return r[e[2]]=l(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=c,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;
"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=function(r,t){return[r,t].filter(Boolean).join(o)},a=["B","KB","MB","GB"],i=function(r){return r.replace(/\D+/g,"")};var c={format:function(r){var t=i(r).replace(/(\d)(\d{3})(\d{3})(\d{2})(\d{2})/,"$1 $2 $3-$4-$5");return"7"===t[0]?"+".concat(t):t},getRaw:i,mask:function(r){return r.substr(0,2)+" ··· ··· "+r.substr(r.length-5,r.length)}};var l=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)}var f=/^[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;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,a=r.currency,i=r.minority,c=r.view,l=e(a);if(null===t)return{majorPart:"",minorPart:"",formatted:"",currencySymbol:l,formattedWithCurrency:u(t,l)};i=0===i?1:i;var s=Math.log(i)*Math.LOG10E,f=(Math.abs(t)/i).toFixed(s),d=f.split(".")[0],m=f.split(".")[1];"default"===c&&t%i==0&&(m="");var p=n(d,3,o,4),h=t<0?"−"+p:p,v=m?h+","+m:h;return{majorPart:h,minorPart:m,currencySymbol:l,formatted:v,formattedWithCurrency:u(v,l)}},exports.formatFileSize=function(r){for(var t=a.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===a.length-1?"99+":""+Number(r.toFixed(2))}(e,n)+" "+a[n]},exports.getAllCurrencyCodes=function(){return Object.keys(r.currency.CURRENCY_SYMBOLS)},exports.getCountries=function(){return r.countries.map(l).sort((function(r,t){return r.name.localeCompare(t.name)}))},exports.getCountriesHash=function(){return r.countries.reduce((function(r,t){return r[t[2]]=l(t),r}),{})},exports.getCurrencySymbol=e,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 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.isValidEmail=function(r){if(!r)return!1;var t=r.split("@");if(2!==t.length)return!1;var e=t[0],n=t[1],o=e.length>64,u=n.length>255;return!o&&!u&&(!n.split(".").some((function(r){return r.length>63}))&&f.test(r))},exports.phoneNumber=c,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.5.1",
"version": "1.6.0",
"description": "common utils",

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

},
"gitHead": "7344be6a187410a248cb3d45c63715f856b372fd"
"gitHead": "4e02050d81ffe4bc4805d7745c2cb158dfd161a4"
}

@@ -79,2 +79,6 @@ <div align="center">

- `splitAmount` — Дробит мажорную часть суммы на части по указанному символу.<br />`splitAmount('10000000', 3, ' ') - '10 000 000'`
- `splitAmount` — Дробит мажорную часть суммы на части по указанному символу.<br />`splitAmount('10000000', 3, ' ') - '10 000 000'`
### [is-valid-email](https://github.com/alfa-laboratory/utils/blob/master/packages/utils/src/is-valid-email/util.ts)
- `isValidEmail` — Возвращает `true` для валидного email, иначе `false` <br />`isValidEmail('alfa@labaratory.com') - 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