🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

mockdate

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mockdate - npm Package Compare versions

Comparing version

to
3.0.5

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

## 3.0.5
- Use Rollup to build a proper UMD package.
## 3.0.4

@@ -2,0 +6,0 @@

@@ -1,7 +0,9 @@

export declare function set(date: string | number | Date): void;
export declare function reset(): void;
declare const _default: {
set: typeof set;
reset: typeof reset;
};
export default _default;
declare module "mockdate" {
export function set(date: string | number | Date): void;
export function reset(): void;
const _default: {
set: typeof set;
reset: typeof reset;
};
export default _default;
}

@@ -1,26 +0,38 @@

var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MockDate = {}));
}(this, (function (exports) { 'use strict';
/*! *****************************************************************************
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.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.reset = exports.set = void 0;
var RealDate = Date;

@@ -31,3 +43,3 @@ var now = null;

function Date(y, m, d, h, M, s, ms) {
var _this = _super.call(this) || this;
_super.call(this) || this;
var date;

@@ -79,16 +91,16 @@ switch (arguments.length) {

}
exports.set = set;
function reset() {
Date = RealDate;
}
exports.reset = reset;
exports.default = {
var mockdate = {
set: set,
reset: reset,
};
if (typeof window !== 'undefined') {
// @ts-ignore
window.MockDate = MockDate;
}
});
//# sourceMappingURL=mockdate.js.map
exports.default = mockdate;
exports.reset = reset;
exports.set = set;
Object.defineProperty(exports, '__esModule', { value: true });
})));
{
"name": "mockdate",
"version": "3.0.4",
"version": "3.0.5",
"description": "A JavaScript mock Date object that can be used to change when \"now\" is.",

@@ -10,2 +10,4 @@ "main": "lib/mockdate.js",

"mocha": "7.1.2",
"rollup": "2.42.4",
"rollup-plugin-typescript2": "0.30.0",
"should": "13.2.3",

@@ -15,3 +17,5 @@ "typescript": "3.9.3"

"scripts": {
"build": "tsc",
"build": "npm run build:js && npm run build:types",
"build:types": "tsc -t esnext --moduleResolution node -d --emitDeclarationOnly --outFile lib/mockdate.d.ts src/mockdate.ts",
"build:js": "rollup -c rollup.config.js",
"test": "npm run build && mocha",

@@ -18,0 +22,0 @@ "prepare": "npm run build",

@@ -77,7 +77,1 @@ const RealDate = Date;

}
if (typeof window !== 'undefined') {
// @ts-ignore
window.MockDate = MockDate;
}
{
"compilerOptions": {
"target": "ES5",
"module": "UMD",
"module": "ES2015",
"declaration": true,

@@ -6,0 +6,0 @@ "noImplicitAny": true,