New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@rjweb/utils

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjweb/utils - npm Package Compare versions

Comparing version
1.4.5
to
1.5.0
+117
lib/cjs/time.js
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var time_exports = {};
__export(time_exports, {
default: () => time_default
});
module.exports = __toCommonJS(time_exports);
class Time {
/**
* Initialize a new Time Class
* @since 1.5.0
*/
constructor(amount) {
this.amount = amount;
}
/**
* Use the provided amount as milliseconds
* @example
* ```
* size(10).ms() // 10
* ```
* @since 1.5.0
*/
ms() {
return this.amount;
}
/**
* Use the provided amount as seconds
* @example
* ```
* time(10).s() // 10000
* ```
* @since 1.5.0
*/
s() {
return this.amount * 1e3;
}
/**
* Use the provided amount as minutes
* @example
* ```
* time(10).m() // 600000
* ```
* @since 1.5.0
*/
m() {
return this.amount * 1e3 * 60;
}
/**
* Use the provided amount as hours
* @example
* ```
* time(10).h() // 36000000
* ```
* @since 1.5.0
*/
h() {
return this.amount * 1e3 * 60 * 60;
}
/**
* Use the provided amount as days
* @example
* ```
* size(10).d() // 8640000000
* ```
* @since 1.5.0
*/
d() {
return this.amount * 1e3 * 60 * 60 * 24;
}
/**
* Use the provided amount as weeks
* @example
* ```
* size(10).w() // 604800000000
* ```
* @since 1.5.0
*/
w() {
return this.amount * 1e3 * 60 * 60 * 24 * 7;
}
}
var time_default = Object.assign(function time(amount) {
return new Time(amount);
}, {
/**
* Wait asyncronously for x ms
* @example
* ```
* import { time } from "@rjweb/utils"
*
* console.log('hi!')
* await time.wait(time(2).s())
* console.log('2 sec later')
* ```
* @since 1.5.0
*/
wait(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
});
class Time {
/**
* Initialize a new Time Class
* @since 1.5.0
*/
constructor(amount) {
this.amount = amount;
}
/**
* Use the provided amount as milliseconds
* @example
* ```
* size(10).ms() // 10
* ```
* @since 1.5.0
*/
ms() {
return this.amount;
}
/**
* Use the provided amount as seconds
* @example
* ```
* time(10).s() // 10000
* ```
* @since 1.5.0
*/
s() {
return this.amount * 1e3;
}
/**
* Use the provided amount as minutes
* @example
* ```
* time(10).m() // 600000
* ```
* @since 1.5.0
*/
m() {
return this.amount * 1e3 * 60;
}
/**
* Use the provided amount as hours
* @example
* ```
* time(10).h() // 36000000
* ```
* @since 1.5.0
*/
h() {
return this.amount * 1e3 * 60 * 60;
}
/**
* Use the provided amount as days
* @example
* ```
* size(10).d() // 8640000000
* ```
* @since 1.5.0
*/
d() {
return this.amount * 1e3 * 60 * 60 * 24;
}
/**
* Use the provided amount as weeks
* @example
* ```
* size(10).w() // 604800000000
* ```
* @since 1.5.0
*/
w() {
return this.amount * 1e3 * 60 * 60 * 24 * 7;
}
}
var time_default = Object.assign(function time(amount) {
return new Time(amount);
}, {
/**
* Wait asyncronously for x ms
* @example
* ```
* import { time } from "@rjweb/utils"
*
* console.log('hi!')
* await time.wait(time(2).s())
* console.log('2 sec later')
* ```
* @since 1.5.0
*/
wait(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
});
export {
time_default as default
};
import { Multiply } from "ts-arithmetic";
declare class Time<Amount extends number> {
private amount;
/**
* Initialize a new Time Class
* @since 1.5.0
*/ constructor(amount: Amount);
/**
* Use the provided amount as milliseconds
* @example
* ```
* size(10).ms() // 10
* ```
* @since 1.5.0
*/ ms(): Amount;
/**
* Use the provided amount as seconds
* @example
* ```
* time(10).s() // 10000
* ```
* @since 1.5.0
*/ s(): Multiply<Amount, 1000>;
/**
* Use the provided amount as minutes
* @example
* ```
* time(10).m() // 600000
* ```
* @since 1.5.0
*/ m(): Multiply<Multiply<Amount, 1000>, 60>;
/**
* Use the provided amount as hours
* @example
* ```
* time(10).h() // 36000000
* ```
* @since 1.5.0
*/ h(): Multiply<Multiply<Multiply<Amount, 1000>, 60>, 60>;
/**
* Use the provided amount as days
* @example
* ```
* size(10).d() // 8640000000
* ```
* @since 1.5.0
*/ d(): Multiply<Multiply<Multiply<Multiply<Amount, 1000>, 60>, 60>, 24>;
/**
* Use the provided amount as weeks
* @example
* ```
* size(10).w() // 604800000000
* ```
* @since 1.5.0
*/ w(): Multiply<Multiply<Multiply<Multiply<Multiply<Amount, 1000>, 60>, 60>, 24>, 7>;
}
/**
* Utility for defining milliseconds
* @example
* ```
* import { time } from "@rjweb/utils"
*
* time(10).h() // 36000000
* ```
* @since 1.5.0
*/ declare const _default: (<Amount extends number>(amount: Amount) => Time<Amount>) & {
/**
* Wait asyncronously for x ms
* @example
* ```
* import { time } from "@rjweb/utils"
*
* console.log('hi!')
* await time.wait(time(2).s())
* console.log('2 sec later')
* ```
* @since 1.5.0
*/ wait(ms: number): Promise<void>;
};
export default _default;
+5
-0

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

## 1.5.0
- Add `number.limit`
- Add `time`
## 1.4.5

@@ -2,0 +7,0 @@

+5
-2

@@ -40,3 +40,4 @@ "use strict";

string: () => string,
system: () => system
system: () => system,
time: () => import_time.default
});

@@ -52,2 +53,3 @@ module.exports = __toCommonJS(src_exports);

var filesystem = __toESM(require("./filesystem"));
var import_time = __toESM(require("./time"));
var import_pckg = require("./pckg.json");

@@ -69,3 +71,4 @@ const Version = import_pckg.version;

string,
system
system,
time
});

@@ -23,2 +23,3 @@ "use strict";

generate: () => generate,
limit: () => limit,
percent: () => percent,

@@ -41,2 +42,8 @@ round: () => round

}
function limit(input, max) {
if (input > max)
return max;
else
return input;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -46,4 +53,5 @@ 0 && (module.exports = {

generate,
limit,
percent,
round
});
{
"name": "@rjweb/utils",
"version": "1.4.5",
"version": "1.5.0",
"description": "Easy and Lightweight Utilities",

@@ -36,4 +36,4 @@ "module": "lib/esm/index.js",

"@rjweb/utils": "link:.",
"@types/bcrypt": "^5.0.0",
"@types/node": "^18.11.18",
"@types/bcrypt": "^5.0.0",
"esbuild": "^0.17.2",

@@ -43,4 +43,5 @@ "typescript": "^5.1.0"

"dependencies": {
"bcrypt": "^5.1.1"
"bcrypt": "^5.1.1",
"ts-arithmetic": "^0.1.1"
}
}

@@ -9,2 +9,3 @@ import * as array from "./array";

import * as filesystem from "./filesystem";
import { default as default2 } from "./time";
import { version } from "./pckg.json";

@@ -25,3 +26,4 @@ const Version = version;

string,
system
system,
default2 as time
};

@@ -14,7 +14,14 @@ function generate(min, max) {

}
function limit(input, max) {
if (input > max)
return max;
else
return input;
}
export {
change,
generate,
limit,
percent,
round
};
{
"name": "@rjweb/utils",
"version": "1.4.5",
"version": "1.5.0",
"description": "Easy and Lightweight Utilities",

@@ -36,4 +36,4 @@ "module": "lib/esm/index.js",

"@rjweb/utils": "link:.",
"@types/bcrypt": "^5.0.0",
"@types/node": "^18.11.18",
"@types/bcrypt": "^5.0.0",
"esbuild": "^0.17.2",

@@ -43,4 +43,5 @@ "typescript": "^5.1.0"

"dependencies": {
"bcrypt": "^5.1.1"
"bcrypt": "^5.1.1",
"ts-arithmetic": "^0.1.1"
}
}

@@ -35,3 +35,3 @@ /**

*
* array.average(arr) //
* array.average(arr) // 38.833333333333336
* ```

@@ -38,0 +38,0 @@ * @since 1.4.5

@@ -10,2 +10,3 @@ /// <reference types="node" />

export * as filesystem from "./filesystem";
export { default as time } from "./time";
export declare const Version: string;

@@ -12,0 +13,0 @@ export type DeepRequired<Type> = Type extends {} ? Type extends Map<any, any> ? Required<Type> : Type extends Set<any> ? Required<Type> : Type extends Buffer ? Required<Type> : Type extends Function ? Required<Type> : Type extends Array<any> ? Required<Type> : Type extends {} ? {

@@ -43,1 +43,13 @@ /**

*/ export declare function change(input: number, changed: number): number;
/**
* Limit a Number
* @example
* ```
* import { number } from "@rjweb/utils"
*
* number.limit(100, 40) // 40
* number.limit(100, 2000) // 100
* number.limit(1042, 1000) // 1000
* ```
* @since 1.5.0
*/ export declare function limit(input: number, max: number): number;
{
"name": "@rjweb/utils",
"version": "1.4.5",
"version": "1.5.0",
"description": "Easy and Lightweight Utilities",

@@ -36,4 +36,4 @@ "module": "lib/esm/index.js",

"@rjweb/utils": "link:.",
"@types/bcrypt": "^5.0.0",
"@types/node": "^18.11.18",
"@types/bcrypt": "^5.0.0",
"esbuild": "^0.17.2",

@@ -43,4 +43,5 @@ "typescript": "^5.1.0"

"dependencies": {
"bcrypt": "^5.1.1"
"bcrypt": "^5.1.1",
"ts-arithmetic": "^0.1.1"
}
}