mybase 1.1.31 → 1.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mybase",
3
- "version": "1.1.31",
3
+ "version": "1.1.33",
4
4
  "description": "",
5
5
  "main": "mybase.js",
6
6
  "scripts": {
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ import { MakeDirectoryOptions } from 'fs';
3
+ export declare function ensureFolder(folderPath: string, options?: MakeDirectoryOptions | null): string;
@@ -0,0 +1 @@
1
+ export declare function getWeekNumber(d?: Date): number;
@@ -1 +1,4 @@
1
+ /// <reference types="@root/ip6addr" />
2
+ import ip6addr from 'ip6addr';
3
+ export declare const private_network_cidrs: ip6addr.CIDR[];
1
4
  export declare function isLANIp(ip: string): boolean;
@@ -1 +1,4 @@
1
+ /// <reference types="@root/ip6addr" />
2
+ import ip6addr from 'ip6addr';
3
+ export declare const local_network_cidrs: ip6addr.CIDR[];
1
4
  export declare function isLoopbackIP(ip: string): boolean;
package/ts/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./funcs/getWeekNumber";
1
2
  export * from "./funcs/Geoip2Paths";
2
3
  export * from "./funcs/isLocal";
3
4
  export * from "./funcs/randomString";
@@ -24,4 +25,6 @@ export * from "./funcs/initMysql2Pool";
24
25
  export * from "./funcs/randomUTFString";
25
26
  export * from "./funcs/MaxRuntimeHours";
26
27
  export * from "./funcs/ensureFolder";
27
-
28
+ export * from "./models/Unixtime";
29
+ export * from "./models/Timespan";
30
+ export * from "./models/IPAddress";
@@ -0,0 +1,40 @@
1
+ /// <reference types="@root/ip6addr" />
2
+ import ip6addr, { ToStringOpts } from 'ip6addr';
3
+ export declare class IPAddress {
4
+ private _ip;
5
+ static loopback_cidrs4: ip6addr.CIDR[];
6
+ static loopback_cidrs6: ip6addr.CIDR[];
7
+ static loopback_cidrs: ip6addr.CIDR[];
8
+ static lan_cidrs4: ip6addr.CIDR[];
9
+ static lan_cidrs6: ip6addr.CIDR[];
10
+ static lan_cidrs: ip6addr.CIDR[];
11
+ static local_cidrs: ip6addr.CIDR[];
12
+ static local_cidrs4: ip6addr.CIDR[];
13
+ static local_cidrs6: ip6addr.CIDR[];
14
+ constructor(ip: string);
15
+ abbreviated(): string;
16
+ toString(opts?: ToStringOpts): string;
17
+ static validate(ip: string): boolean;
18
+ static try(ip: string): IPAddress | undefined;
19
+ static fromString(ip: string): IPAddress;
20
+ static get Empty(): IPAddress;
21
+ isLoopbackIP(): boolean;
22
+ isLANIP(): boolean;
23
+ isLocalIP(): boolean;
24
+ partOfCIDR(cidr_networks: ip6addr.CIDR[]): boolean;
25
+ static partOfCIDR(_ip: string, cidr_networks: ip6addr.CIDR[]): boolean;
26
+ isPublicIP(): boolean;
27
+ static unserialize(serializedIpString: string): IPAddress;
28
+ static randomIP4(): IPAddress;
29
+ static randomIP6(): IPAddress;
30
+ static randomCIDRIp(cidr: ip6addr.CIDR[] | 'loopback' | 'lan' | 'local' | 'loopback4' | 'loopback6' | 'lan4' | 'lan6' | 'local4' | 'local6'): IPAddress;
31
+ serialize(): string;
32
+ kind(): number;
33
+ equals(secondIp: IPAddress): boolean;
34
+ randomPad(): string;
35
+ normalized(): string;
36
+ private padIp6;
37
+ private padIp4;
38
+ asciiChecksum(): string;
39
+ checksum1(): string;
40
+ }
@@ -0,0 +1,18 @@
1
+ export declare class Timespan {
2
+ private readonly ms;
3
+ constructor(ms: number);
4
+ get miliseconds(): number;
5
+ get seconds(): number;
6
+ get minutes(): number;
7
+ get hours(): number;
8
+ get days(): number;
9
+ get weeks(): number;
10
+ get months(): number;
11
+ static miliseconds(amount: number): Timespan;
12
+ static seconds(amount: number): Timespan;
13
+ static minutes(mins: number): Timespan;
14
+ static hours(hours: number): Timespan;
15
+ static days(days: number): Timespan;
16
+ static weeks(weeks: number): Timespan;
17
+ static months(months: number): Timespan;
18
+ }
@@ -0,0 +1,32 @@
1
+ import { Timespan } from "./Timespan";
2
+ export declare class Unixtime {
3
+ private value;
4
+ static EMPTY: Unixtime;
5
+ static NOW(): Unixtime;
6
+ static now(): Unixtime;
7
+ greaterThan(other: Unixtime): boolean;
8
+ isEmpty(): boolean;
9
+ lessThan(other: Unixtime): boolean;
10
+ get elapsed(): Timespan;
11
+ constructor(value: Date | string | number);
12
+ addTimespan(timespan: Timespan): Unixtime;
13
+ subtractTimespan(timespan: Timespan): Unixtime;
14
+ addMiliseconds(miliseconds?: number): Unixtime;
15
+ addSeconds(seconds?: number): Unixtime;
16
+ addMinutes(minutes?: number): Unixtime;
17
+ addHours(hours?: number): Unixtime;
18
+ addDays(days?: number): Unixtime;
19
+ addMonths(months?: number): Unixtime;
20
+ addYears(years?: number): Unixtime;
21
+ yyyymmdd(): string;
22
+ yyymmddhh(): string;
23
+ getDay(): number;
24
+ static from(value: Date | string | number): Unixtime;
25
+ toShortUnixtime(): number;
26
+ toLongUnixtime(): number;
27
+ toDate(): Date;
28
+ toISOString(): string;
29
+ elapsedSeconds(): number;
30
+ elapsedMinutes(): number;
31
+ static try(value: Date | string | number): Unixtime | null;
32
+ }
package/tsconfig.json CHANGED
@@ -8,6 +8,7 @@
8
8
  "esModuleInterop": true,
9
9
  "forceConsistentCasingInFileNames": true,
10
10
  "strict": true,
11
+ "declaration": true, // Generates corresponding .d.ts file
11
12
  "noImplicitReturns": true, // Report error when not all code paths in function return a value
12
13
  "noUnusedLocals": true, // Report errors on unused locals
13
14
  // "noUnusedParameters": true, // Report errors on unused parameters
File without changes