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

@endpass/utils

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@endpass/utils - npm Package Compare versions

Comparing version 1.8.7 to 1.9.0

46

date.js

@@ -7,2 +7,3 @@ 'use strict';

var relativeTime = _interopDefault(require('dayjs/plugin/relativeTime'));
var weekOfYear = _interopDefault(require('dayjs/plugin/weekOfYear'));

@@ -14,18 +15,33 @@ /**

dayjs.extend(relativeTime);
dayjs.extend(weekOfYear);
var formateDate = function formateDate(date) {
var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD H:mm';
return dayjs(date).format(template);
};
var fromNow = function fromNow(date) {
return dayjs(date).fromNow();
};
var fromTo = function fromTo(fromDate, toDate) {
var start = dayjs(fromDate);
return start.to(dayjs(toDate));
};
var addToDate = function addToDate(date, value) {
var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 's';
return dayjs(date).add(value, unit).toDate();
};
var getWeek = function getWeek(date) {
return dayjs(date).week();
};
module.exports = {
formateDate: function formateDate(date) {
var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD H:mm';
return dayjs(date).format(template);
},
fromNow: function fromNow(date) {
return dayjs(date).fromNow();
},
fromTo: function fromTo(fromDate, toDate) {
var start = dayjs(fromDate);
return start.to(dayjs(toDate));
},
addToDate: function addToDate(date, value) {
var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 's';
return dayjs(date).add(value, unit).toDate();
}
formateDate: formateDate,
fromNow: fromNow,
fromTo: fromTo,
addToDate: addToDate,
getWeek: getWeek
};
'use strict';
// eslint-disable-next-line
module.exports.isNumeric = function (n) {
var isNumeric = function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
var toFixed = function toFixed(num) {
return !num ? '0' : (num / 100).toFixed(2);
};
module.exports = {
isNumeric: isNumeric,
toFixed: toFixed
};
{
"name": "@endpass/utils",
"version": "1.8.7",
"version": "1.9.0",
"description": "Utils and helper functions",

@@ -5,0 +5,0 @@ "author": "Endpass, Inc",

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