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

@ukon1990/js-utilities

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ukon1990/js-utilities - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

1

dist/utils/date.util.d.ts
export declare class DateUtil {
private static getDifference;
/**

@@ -3,0 +4,0 @@ * Returns the difference between two dates in milliseconds

23

dist/utils/date.util.js

@@ -0,35 +1,22 @@

import { TimeSince } from '../models/time-since.model';
export class DateUtil {
/*
private static getDifference(from: Date | number, to: Date | number) {
/* istanbul ignore next */
static getDifference(from, to) {
let msSince = DateUtil.getDifferenceInMS(from, to);
const minuteInMS = 60000;
const hourInMS = 3600000;
const dayInMs = hourInMS * 24;
const ms = msSince % 1000;
msSince -= ms;
const seconds = ( msSince / 1000) % minuteInMS;
const seconds = (msSince / 1000) % minuteInMS;
msSince -= ms;
const minutes = (msSince / minuteInMS) % minuteInMS;
msSince -= ms;
const hours = (msSince / minuteInMS) % hourInMS;
msSince -= ms;
const days = (msSince / hourInMS) % dayInMs;
msSince -= ms;
const weeks = (msSince / dayInMs) % dayInMs * 7;
return new TimeSince(
weeks,
days,
hours,
minutes,
seconds,
ms);
return new TimeSince(weeks, days, hours, minutes, seconds, ms);
}
*/
/**

@@ -36,0 +23,0 @@ * Returns the difference between two dates in milliseconds

import { DateUtil } from './date.util';
describe('DateUtil', () => {
/*
describe('getDifference', () => {
it('can get time from a year ago or so', () => {
expect(DateUtil.getDifference(
new Date('May 4 2018 09:24:20'),
new Date('July 4 2018 10:34:35')))
.toEqual(
new TimeSince(
60, // Weeks
6,
1,
10,
15,
0
)
);
});
});*/
it('getDifferenceInMS', () => {

@@ -4,0 +22,0 @@ expect(DateUtil.getDifferenceInMS(new Date('May 4 2018 09:24:20'), new Date('May 4 2018 09:24:21')))

@@ -8,4 +8,4 @@ import { ArrayUtil } from './array.util';

static isNullOrUndefined(value, value2) {
return (!value && isNaN(value)) || value === null &&
(!value && isNaN(value2)) || value2 === null;
return (value === undefined && isNaN(value)) || value === null &&
(value2 === undefined && isNaN(value2)) || value2 === null;
}

@@ -12,0 +12,0 @@ /**

{
"name": "@ukon1990/js-utilities",
"version": "1.5.0",
"version": "1.5.1",
"description": "A light weight package for object and array manipulation. As well as some utilities for matching text.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import {DateUtil} from './date.util';
import {TimeSince} from '../models/time-since.model';
describe('DateUtil', () => {/*
describe('DateUtil', () => {
/*
describe('getDifference', () => {

@@ -12,3 +13,3 @@ it('can get time from a year ago or so', () => {

new TimeSince(
60,
60, // Weeks
6,

@@ -15,0 +16,0 @@ 1,

import {TimeSince} from '../models/time-since.model';
export class DateUtil {
/*
private static getDifference(from: Date | number, to: Date | number) {
/* istanbul ignore next */
private static getDifference(from: Date | number, to: Date | number): TimeSince {
let msSince = DateUtil.getDifferenceInMS(from, to);

@@ -36,3 +36,2 @@

}
*/

@@ -39,0 +38,0 @@ /**

@@ -9,4 +9,4 @@ import {ArrayUtil} from './array.util';

public static isNullOrUndefined(value: any, value2?: any): boolean {
return (!value && isNaN(value)) || value === null &&
(!value && isNaN(value2)) || value2 === null;
return (value === undefined && isNaN(value)) || value === null &&
(value2 === undefined && isNaN(value2)) || value2 === null;
}

@@ -13,0 +13,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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