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

@lms-elements/utils

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lms-elements/utils - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

build/@types/packages/Utils/src/composeFormValidators.d.ts

1

build/@types/packages/Utils/src/index.d.ts

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

export { composeFormValidators } from './composeFormValidators';
export { composeValidators } from './composeValidators';

@@ -2,0 +3,0 @@ export * from './Date';

@@ -1,2 +0,16 @@

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("moment")),r=function(t,e){return t.split(" ").map((function(t,r){return r===e-1?t[0].toUpperCase()+t.slice(1):t})).join(" ")},n=function(t){var n=e.default(t).format("D MMMM");return r(n,2)},a=function(t){return e.default(t).get("date")},o=function(t){var e=a(t);return 1===e?n(t):String(e)},u=function(t,e){if("object"!=typeof t&&"object"!=typeof e||null===t||null===e)return t===e;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t){if(!(r in e))return!1;if(!u(t[r],e[r]))return!1}return!0},f=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.%]+$/gm);exports.capitalizeWord=r,exports.checkIsPeriodEnd=function(t,r){return e.default(r).isAfter(t)},exports.checkOverdue=function(t){return!!t&&Number(new Date)-Number(new Date(t))>0},exports.composeValidators=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return t.reduce((function(t,r){return t||r&&r(e)}),void 0)}},exports.convertDateToHtmlDateString=function(t){return e.default(t).format("YYYY-MM-DD")},exports.deepEqual=u,exports.detectTouchDirection=function(t,e){var r=t.touches[0],n=e.touches[0],a=r.clientY-n.clientY,o=r.clientX-n.clientX;return Math.abs(a)>Math.abs(o)?a<0?"bottom":"top":o<0?"right":"left"},exports.equalItemsInArrays=function(t,e,r){if(t.length!==e.length)return!1;var n=t.sort(r),a=e.sort(r);return u(n,a)},exports.formatDate=function(t){return e.default(t).format("LL").split(" ").slice(0,2).join(" ")},exports.getCalendarDropdownDays=function(t,r){var n=e.default().set({month:t,year:r}).startOf("month"),a=n.daysInMonth();return new Array(a).fill(" ").map((function(t,r){var a=e.default(n).add(r,"d");return{label:a.format("D"),inactive:!1,date:a.format("YYYY-MM-DD")}}))},exports.getCalendarWeekTitle=function(t){var a=r(e.default(t).format("dd"),1);return"Пн"===a?a+" - "+n(t):a+" - "+o(t)},exports.getCapitalizeEndOfWeek=function(t){var n=e.default(t).endOf("week").format("D MMMM YYYY");return r(n,2)},exports.getCapitalizeMonth=n,exports.getCapitalizeMonthAndYear=function(t){var n=e.default(t).format("MMMM YYYY");if(Array.isArray(t)){var a=t[0],o=t[1];n=e.default().set({month:a,year:o}).format("MMMM YYYY")}return r(n,1)},exports.getCapitalizeStartOfWeek=function(t){var n=e.default(t).startOf("week").format("D MMMM YYYY");return r(n,2)},exports.getDateComponents=function(t){var r,a,o,u;return{month:(null===(r=e.default(t))||void 0===r?void 0:r.get("month"))||e.default().get("month"),year:(null===(a=e.default(t))||void 0===a?void 0:a.get("year"))||e.default().get("year"),dateWithoutTime:t?(null===(o=e.default(t))||void 0===o?void 0:o.format("YYYY-MM-DD"))||e.default().format("YYYY-MM-DD"):void 0,time:t?(null===(u=e.default(t))||void 0===u?void 0:u.format("HH:mm"))||e.default(t).format("HH:mm"):void 0,dateWithMonth:t?e.default().isBefore(t)&&e.default().format("D")!==e.default(t).format("D")?n(t):"сегодня":void 0}},exports.getDateWithAbbreviatedMonth=function(t){return e.default(t).format("DD MMM")},exports.getDateWithTime=function(t){return r(e.default(t).format("D MMMM [в] HH:mm"),2)},exports.getDateWithoutYear=function(t){return e.default(t).format("DD.MM")},exports.getDatepickerSelectTitle=function(t){var r=e.default(t).format("DD.MM.YYYY"),n=e.default(t).format("HH:mm");return"00:00"===n?""+r:r+" в "+n},exports.getDayOfMonth=a,exports.getDayOfMonthTitle=o,exports.getDaysInMonth=function(t){return e.default(t,"YYYY-MM").daysInMonth()},exports.getEarliestDate=function(t){return t.reduce((function(t,r){return e.default(t).isBefore(r)?e.default(t).format():e.default(r).format()}),e.default().format())},exports.getEndOfMonth=function(t){return e.default(t).endOf("month").format("YYYY-MM-DD")},exports.getEndOfWeek=function(t){return e.default(t).endOf("week").format("YYYY-MM-DD")},exports.getNumberMinutesBeforeDate=function(t){var r=e.default(t).fromNow();return r.includes("через")||r.includes("in")?r.split(" ").slice(1,3).map((function(t,e){return 1===e&&t.length>4?t.split("").slice(0,3).join("")+".":t})).join(""):r},exports.getObjectPropertyByString=function(t,e){return e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".").forEach((function(e){e in t&&(t=t[e])})),t||void 0},exports.getSelectedDate=function(t,r){var n=(null==r?void 0:r.split(":"))||[0,0],a=n[0],o=n[1];return e.default(t).add(a,"h").add(o,"minute")},exports.getStartOfMonth=function(t){return e.default(t).startOf("month").format("YYYY-MM-DD")},exports.getStartOfWeek=function(t){return e.default(t).startOf("week").format("YYYY-MM-DD")},exports.getTimeAfterDate=function(t){return e.default(t).fromNow(!0)},exports.getTimeArray=function(t,e,r){void 0===r&&(r=60);for(var n=[],a=60*e,o=60*t;o<=a;o+=r){var u=Math.floor(o/60),f=o%60,i=String(u).length<2?"0"+u:String(u),d=String(f).length<2?"0"+f:String(f);n.push(i+":"+d)}return n},exports.getTimeBeforeDate=function(t){return e.default(t).toNow(!0)},exports.getTimeStatus=function(t,r){var n=e.default(t).add(15,"m").format(),a=e.default().isBefore(t),o=e.default().isBetween(t,n),u=e.default().isBetween(n,r);return a?"future":o?"present":u?"late":"past"},exports.getTodayData=function(){return e.default().format("YYYY-MM-DD")},exports.getTwoCharsDate=function(t){return e.default(t).format("DD")},exports.getValueInRange=function(t,e,r){return Math.max(t,Math.min(e,r))},exports.getWeekArray=function(t){for(var r=e.default(t),n=[],a=0;a<7;a+=1){var o=e.default(r).add(a,"d").format("YYYY-MM-DD");n.push(o)}return n},exports.getWeekday=function(t){var n=7-e.default(t).startOf("month").weekday();if(a(t)<=n){var o=e.default(t).format("dd");return r(o,1)}},exports.getWeekdayNames=function(){return new Array(7).fill(" ").map((function(t,e){switch(e){case 0:return"Пн";case 1:return"Вт";case 2:return"Ср";case 3:return"Чт";case 4:return"Пт";case 5:return"Сб";default:return"Вс"}}))},exports.getWeekdayNumber=function(t){return e.default(t).weekday()},exports.isDateTomorrow=function(t){var r=e.default().endOf("day"),n=e.default().add(1,"day").endOf("day");return e.default(t).isBetween(r,n)},exports.isInactive=function(t,r){return"past"===r?e.default().startOf("day").isAfter(t):"future"===r?!e.default().endOf("day").isAfter(t):r instanceof Function&&r(t)},exports.isURL=function(t){return Boolean(t.match(f))},exports.minusDaysToCurrentDate=function(t,e){return new Date(t.getTime()-864e5*e)},exports.plusDaysToCurrentDate=function(t,e){return new Date(t.getTime()+864e5*e)},exports.sleep=function(t){return new Promise((function(e){return setTimeout(e,t)}))},exports.trimString=function(t,e,r){var n=t;return t.length>e&&(n=t.substr(0,e),n+=r),n};
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("moment")),r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)},n=function(t,e){return t.split(" ").map((function(t,r){return r===e-1?t[0].toUpperCase()+t.slice(1):t})).join(" ")},a=function(t){var r=e.default(t).format("D MMMM");return n(r,2)},o=function(t){return e.default(t).get("date")},u=function(t){var e=o(t);return 1===e?a(t):String(e)},f=function(t,e){if("object"!=typeof t&&"object"!=typeof e||null===t||null===e)return t===e;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t){if(!(r in e))return!1;if(!f(t[r],e[r]))return!1}return!0},i=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.%]+$/gm);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */exports.capitalizeWord=n,exports.checkIsPeriodEnd=function(t,r){return e.default(r).isAfter(t)},exports.checkOverdue=function(t){return!!t&&Number(new Date)-Number(new Date(t))>0},exports.composeFormValidators=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return t.reduce((function(t,n){return r(r({},t),n(e))}),{})}},exports.composeValidators=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return t.reduce((function(t,r){return t||r&&r(e)}),void 0)}},exports.convertDateToHtmlDateString=function(t){return e.default(t).format("YYYY-MM-DD")},exports.deepEqual=f,exports.detectTouchDirection=function(t,e){var r=t.touches[0],n=e.touches[0],a=r.clientY-n.clientY,o=r.clientX-n.clientX;return Math.abs(a)>Math.abs(o)?a<0?"bottom":"top":o<0?"right":"left"},exports.equalItemsInArrays=function(t,e,r){if(t.length!==e.length)return!1;var n=t.sort(r),a=e.sort(r);return f(n,a)},exports.formatDate=function(t){return e.default(t).format("LL").split(" ").slice(0,2).join(" ")},exports.getCalendarDropdownDays=function(t,r){var n=e.default().set({month:t,year:r}).startOf("month"),a=n.daysInMonth();return new Array(a).fill(" ").map((function(t,r){var a=e.default(n).add(r,"d");return{label:a.format("D"),inactive:!1,date:a.format("YYYY-MM-DD")}}))},exports.getCalendarWeekTitle=function(t){var r=n(e.default(t).format("dd"),1);return"Пн"===r?r+" - "+a(t):r+" - "+u(t)},exports.getCapitalizeEndOfWeek=function(t){var r=e.default(t).endOf("week").format("D MMMM YYYY");return n(r,2)},exports.getCapitalizeMonth=a,exports.getCapitalizeMonthAndYear=function(t){var r=e.default(t).format("MMMM YYYY");if(Array.isArray(t)){var a=t[0],o=t[1];r=e.default().set({month:a,year:o}).format("MMMM YYYY")}return n(r,1)},exports.getCapitalizeStartOfWeek=function(t){var r=e.default(t).startOf("week").format("D MMMM YYYY");return n(r,2)},exports.getDateComponents=function(t){var r,n,o,u;return{month:(null===(r=e.default(t))||void 0===r?void 0:r.get("month"))||e.default().get("month"),year:(null===(n=e.default(t))||void 0===n?void 0:n.get("year"))||e.default().get("year"),dateWithoutTime:t?(null===(o=e.default(t))||void 0===o?void 0:o.format("YYYY-MM-DD"))||e.default().format("YYYY-MM-DD"):void 0,time:t?(null===(u=e.default(t))||void 0===u?void 0:u.format("HH:mm"))||e.default(t).format("HH:mm"):void 0,dateWithMonth:t?e.default().isBefore(t)&&e.default().format("D")!==e.default(t).format("D")?a(t):"сегодня":void 0}},exports.getDateWithAbbreviatedMonth=function(t){return e.default(t).format("DD MMM")},exports.getDateWithTime=function(t){return n(e.default(t).format("D MMMM [в] HH:mm"),2)},exports.getDateWithoutYear=function(t){return e.default(t).format("DD.MM")},exports.getDatepickerSelectTitle=function(t){var r=e.default(t).format("DD.MM.YYYY"),n=e.default(t).format("HH:mm");return"00:00"===n?""+r:r+" в "+n},exports.getDayOfMonth=o,exports.getDayOfMonthTitle=u,exports.getDaysInMonth=function(t){return e.default(t,"YYYY-MM").daysInMonth()},exports.getEarliestDate=function(t){return t.reduce((function(t,r){return e.default(t).isBefore(r)?e.default(t).format():e.default(r).format()}),e.default().format())},exports.getEndOfMonth=function(t){return e.default(t).endOf("month").format("YYYY-MM-DD")},exports.getEndOfWeek=function(t){return e.default(t).endOf("week").format("YYYY-MM-DD")},exports.getNumberMinutesBeforeDate=function(t){var r=e.default(t).fromNow();return r.includes("через")||r.includes("in")?r.split(" ").slice(1,3).map((function(t,e){return 1===e&&t.length>4?t.split("").slice(0,3).join("")+".":t})).join(""):r},exports.getObjectPropertyByString=function(t,e){return e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".").forEach((function(e){e in t&&(t=t[e])})),t||void 0},exports.getSelectedDate=function(t,r){var n=(null==r?void 0:r.split(":"))||[0,0],a=n[0],o=n[1];return e.default(t).add(a,"h").add(o,"minute")},exports.getStartOfMonth=function(t){return e.default(t).startOf("month").format("YYYY-MM-DD")},exports.getStartOfWeek=function(t){return e.default(t).startOf("week").format("YYYY-MM-DD")},exports.getTimeAfterDate=function(t){return e.default(t).fromNow(!0)},exports.getTimeArray=function(t,e,r){void 0===r&&(r=60);for(var n=[],a=60*e,o=60*t;o<=a;o+=r){var u=Math.floor(o/60),f=o%60,i=String(u).length<2?"0"+u:String(u),d=String(f).length<2?"0"+f:String(f);n.push(i+":"+d)}return n},exports.getTimeBeforeDate=function(t){return e.default(t).toNow(!0)},exports.getTimeStatus=function(t,r){var n=e.default(t).add(15,"m").format(),a=e.default().isBefore(t),o=e.default().isBetween(t,n),u=e.default().isBetween(n,r);return a?"future":o?"present":u?"late":"past"},exports.getTodayData=function(){return e.default().format("YYYY-MM-DD")},exports.getTwoCharsDate=function(t){return e.default(t).format("DD")},exports.getValueInRange=function(t,e,r){return Math.max(t,Math.min(e,r))},exports.getWeekArray=function(t){for(var r=e.default(t),n=[],a=0;a<7;a+=1){var o=e.default(r).add(a,"d").format("YYYY-MM-DD");n.push(o)}return n},exports.getWeekday=function(t){var r=7-e.default(t).startOf("month").weekday();if(o(t)<=r){var a=e.default(t).format("dd");return n(a,1)}},exports.getWeekdayNames=function(){return new Array(7).fill(" ").map((function(t,e){switch(e){case 0:return"Пн";case 1:return"Вт";case 2:return"Ср";case 3:return"Чт";case 4:return"Пт";case 5:return"Сб";default:return"Вс"}}))},exports.getWeekdayNumber=function(t){return e.default(t).weekday()},exports.isDateTomorrow=function(t){var r=e.default().endOf("day"),n=e.default().add(1,"day").endOf("day");return e.default(t).isBetween(r,n)},exports.isInactive=function(t,r){return"past"===r?e.default().startOf("day").isAfter(t):"future"===r?!e.default().endOf("day").isAfter(t):r instanceof Function&&r(t)},exports.isURL=function(t){return Boolean(t.match(i))},exports.minusDaysToCurrentDate=function(t,e){return new Date(t.getTime()-864e5*e)},exports.plusDaysToCurrentDate=function(t,e){return new Date(t.getTime()+864e5*e)},exports.sleep=function(t){return new Promise((function(e){return setTimeout(e,t)}))},exports.trimString=function(t,e,r){var n=t;return t.length>e&&(n=t.substr(0,e),n+=r),n};
//# sourceMappingURL=index.js.map

4

package.json
{
"name": "@lms-elements/utils",
"version": "1.0.16",
"version": "1.0.17",
"description": "commonly used utilities",

@@ -45,3 +45,3 @@ "keywords": [

},
"gitHead": "853c0670cb4055c7d143a746b150ddeaaf8c33db"
"gitHead": "14ac93c5787f7c438d0b853fa3b82bc4ab824b26"
}

Sorry, the diff of this file is not supported yet

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