@definitelytyped/utils 0.0.112-next.9 → 0.0.112
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/dist/collections.d.ts +4 -5
- package/dist/collections.js +17 -24
- package/dist/collections.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/semver.d.ts +0 -32
- package/dist/semver.js +0 -82
- package/dist/semver.js.map +0 -1
package/dist/collections.d.ts
CHANGED
|
@@ -51,8 +51,7 @@ export declare function recordToMap<T>(record: Record<string, T>): Map<string, T
|
|
|
51
51
|
export declare function recordToMap<T, U>(record: Record<string, T>, cb: (t: T) => U): Map<string, U>;
|
|
52
52
|
export declare function mapToRecord<T>(map: Map<string, T>): Record<string, T>;
|
|
53
53
|
export declare function mapToRecord<T, U>(map: Map<string, T>, cb: (t: T) => U): Record<string, U>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export declare function best<T>(inputs: Iterable<T>, isBetter: (a: T, b: T) => boolean): T | undefined;
|
|
54
|
+
export declare function min<T>(array: readonly [T, ...(T | undefined)[]]): T;
|
|
55
|
+
export declare function min<T>(array: readonly T[], compare?: (a: T, b: T) => number): T | undefined;
|
|
56
|
+
export declare function max<T>(array: readonly [T, ...(T | undefined)[]]): T;
|
|
57
|
+
export declare function max<T>(array: readonly T[], compare?: (a: T, b: T) => number): T | undefined;
|
package/dist/collections.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.max = exports.min = exports.mapToRecord = exports.recordToMap = exports.sortObjectKeys = exports.unique = exports.flatMap = exports.isArray = exports.append = exports.addRange = exports.split = exports.join = exports.sort = exports.flatMapIterable = exports.mapIterable = exports.mapDefinedAsync = exports.mapDefined = exports.mapValues = exports.initArray = void 0;
|
|
4
4
|
function initArray(length, makeElement) {
|
|
5
5
|
const arr = new Array(length);
|
|
6
6
|
for (let i = 0; i < length; i++) {
|
|
@@ -169,27 +169,20 @@ function mapToRecord(map, cb) {
|
|
|
169
169
|
return o;
|
|
170
170
|
}
|
|
171
171
|
exports.mapToRecord = mapToRecord;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (isBetter(value, res)) {
|
|
189
|
-
res = value;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return res;
|
|
193
|
-
}
|
|
194
|
-
exports.best = best;
|
|
172
|
+
function min(array, compare) {
|
|
173
|
+
return array.length === 0
|
|
174
|
+
? undefined
|
|
175
|
+
: array.reduce((previousValue, currentValue) => (compare ? compare(currentValue, previousValue) < 0 : currentValue < previousValue)
|
|
176
|
+
? currentValue
|
|
177
|
+
: previousValue);
|
|
178
|
+
}
|
|
179
|
+
exports.min = min;
|
|
180
|
+
function max(array, compare) {
|
|
181
|
+
return array.length === 0
|
|
182
|
+
? undefined
|
|
183
|
+
: array.reduce((previousValue, currentValue) => (compare ? compare(currentValue, previousValue) > 0 : currentValue > previousValue)
|
|
184
|
+
? currentValue
|
|
185
|
+
: previousValue);
|
|
186
|
+
}
|
|
187
|
+
exports.max = max;
|
|
195
188
|
//# sourceMappingURL=collections.js.map
|
package/dist/collections.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CAAI,MAAc,EAAE,WAA6B;IACxE,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,KAAK,IAA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0B,EAAE,CAAC;IACpC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACzB,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACX,CAAC;AAND,kCAMC;AAID,SAAgB,GAAG,CAAI,KAAmB,EAAE,OAAgC;IAC1E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,CAC3C,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,aAAa,CAAC;YACjF,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,aAAa,CAClB,CAAC;AACR,CAAC;AARD,kBAQC;AAID,SAAgB,GAAG,CAAI,KAAmB,EAAE,OAAgC;IAC1E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,CAC3C,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,aAAa,CAAC;YACjF,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,aAAa,CAClB,CAAC;AACR,CAAC;AARD,kBAQC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,6 +20,5 @@ __exportStar(require("./miscellany"), exports);
|
|
|
20
20
|
__exportStar(require("./npm"), exports);
|
|
21
21
|
__exportStar(require("./process"), exports);
|
|
22
22
|
__exportStar(require("./progress"), exports);
|
|
23
|
-
__exportStar(require("./semver"), exports);
|
|
24
23
|
__exportStar(require("./typescript-installer"), exports);
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,gDAA8B;AAC9B,uCAAqB;AACrB,uCAAqB;AACrB,4CAA0B;AAC1B,+CAA6B;AAC7B,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,gDAA8B;AAC9B,uCAAqB;AACrB,uCAAqB;AACrB,4CAA0B;AAC1B,+CAA6B;AAC7B,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,yDAAuC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@definitelytyped/utils",
|
|
3
|
-
"version": "0.0.112
|
|
3
|
+
"version": "0.0.112",
|
|
4
4
|
"description": "Shared utilities for DefinitelyTyped tools",
|
|
5
5
|
"homepage": "https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/utils#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "https://github.com/microsoft/DefinitelyTyped-tools/issues"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@definitelytyped/typescript-versions": "^0.0.112
|
|
22
|
+
"@definitelytyped/typescript-versions": "^0.0.112",
|
|
23
23
|
"@qiwi/npm-registry-client": "^8.9.1",
|
|
24
24
|
"@types/node": "^14.14.35",
|
|
25
25
|
"charm": "^1.0.2",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "bf52b08dedb8e7860337a5e1091f42d07d849ffb"
|
|
41
41
|
}
|
package/dist/semver.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** Version of a package published to NPM. */
|
|
2
|
-
export declare class Semver {
|
|
3
|
-
readonly major: number;
|
|
4
|
-
readonly minor: number;
|
|
5
|
-
readonly patch: number;
|
|
6
|
-
static parse(semver: string, coerce?: boolean): Semver;
|
|
7
|
-
static fromRaw({ major, minor, patch }: {
|
|
8
|
-
major: number;
|
|
9
|
-
minor: number;
|
|
10
|
-
patch: number;
|
|
11
|
-
}): Semver;
|
|
12
|
-
/**
|
|
13
|
-
* Returns 0 if equal, 1 if x > y, -1 if x < y
|
|
14
|
-
*/
|
|
15
|
-
static compare(x: Semver, y: Semver): 0 | 1 | -1;
|
|
16
|
-
/**
|
|
17
|
-
* Per the semver spec <http://semver.org/#spec-item-2>:
|
|
18
|
-
*
|
|
19
|
-
* A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes.
|
|
20
|
-
*
|
|
21
|
-
* @note This must parse the output of `versionString`.
|
|
22
|
-
*
|
|
23
|
-
* @param semver The version string.
|
|
24
|
-
* @param coerce Without this optional parameter the version MUST follow the above semver spec. However, when set to `true` components after the
|
|
25
|
-
* major version may be omitted. I.e. `1` equals `1.0` and `1.0.0`.
|
|
26
|
-
*/
|
|
27
|
-
static tryParse(semver: string, coerce?: boolean): Semver | undefined;
|
|
28
|
-
constructor(major: number, minor: number, patch: number);
|
|
29
|
-
get versionString(): string;
|
|
30
|
-
equals(other: Semver): boolean;
|
|
31
|
-
greaterThan(other: Semver): boolean;
|
|
32
|
-
}
|
package/dist/semver.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Semver = void 0;
|
|
4
|
-
/** Version of a package published to NPM. */
|
|
5
|
-
class Semver {
|
|
6
|
-
constructor(major, minor, patch) {
|
|
7
|
-
this.major = major;
|
|
8
|
-
this.minor = minor;
|
|
9
|
-
this.patch = patch;
|
|
10
|
-
}
|
|
11
|
-
static parse(semver, coerce) {
|
|
12
|
-
const result = Semver.tryParse(semver, coerce);
|
|
13
|
-
if (!result) {
|
|
14
|
-
throw new Error(`Unexpected semver: ${semver}`);
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
static fromRaw({ major, minor, patch }) {
|
|
19
|
-
return new Semver(major, minor, patch);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Returns 0 if equal, 1 if x > y, -1 if x < y
|
|
23
|
-
*/
|
|
24
|
-
static compare(x, y) {
|
|
25
|
-
const versions = [
|
|
26
|
-
[x.major, y.major],
|
|
27
|
-
[x.minor, y.minor],
|
|
28
|
-
[x.patch, y.patch],
|
|
29
|
-
];
|
|
30
|
-
for (const [componentX, componentY] of versions) {
|
|
31
|
-
if (componentX > componentY) {
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
34
|
-
if (componentX < componentY) {
|
|
35
|
-
return -1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Per the semver spec <http://semver.org/#spec-item-2>:
|
|
42
|
-
*
|
|
43
|
-
* A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes.
|
|
44
|
-
*
|
|
45
|
-
* @note This must parse the output of `versionString`.
|
|
46
|
-
*
|
|
47
|
-
* @param semver The version string.
|
|
48
|
-
* @param coerce Without this optional parameter the version MUST follow the above semver spec. However, when set to `true` components after the
|
|
49
|
-
* major version may be omitted. I.e. `1` equals `1.0` and `1.0.0`.
|
|
50
|
-
*/
|
|
51
|
-
static tryParse(semver, coerce) {
|
|
52
|
-
const rgx = /^(\d+)(\.(\d+))?(\.(\d+))?$/;
|
|
53
|
-
const match = rgx.exec(semver);
|
|
54
|
-
if (match) {
|
|
55
|
-
const { 1: major, 3: minor, 5: patch } = match;
|
|
56
|
-
if ((minor !== undefined && patch !== undefined) || coerce) {
|
|
57
|
-
// tslint:disable-line:strict-type-predicates
|
|
58
|
-
return new Semver(intOfString(major), intOfString(minor || "0"), intOfString(patch || "0"));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
get versionString() {
|
|
64
|
-
const { major, minor, patch } = this;
|
|
65
|
-
return `${major}.${minor}.${patch}`;
|
|
66
|
-
}
|
|
67
|
-
equals(other) {
|
|
68
|
-
return Semver.compare(this, other) === 0;
|
|
69
|
-
}
|
|
70
|
-
greaterThan(other) {
|
|
71
|
-
return Semver.compare(this, other) === 1;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.Semver = Semver;
|
|
75
|
-
function intOfString(str) {
|
|
76
|
-
const n = Number.parseInt(str, 10);
|
|
77
|
-
if (Number.isNaN(n)) {
|
|
78
|
-
throw new Error(`Error in parseInt(${JSON.stringify(str)})`);
|
|
79
|
-
}
|
|
80
|
-
return n;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=semver.js.map
|
package/dist/semver.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../src/semver.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,MAAa,MAAM;IAyDjB,YAAqB,KAAa,EAAW,KAAa,EAAW,KAAa;QAA7D,UAAK,GAAL,KAAK,CAAQ;QAAW,UAAK,GAAL,KAAK,CAAQ;QAAW,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAxDtF,MAAM,CAAC,KAAK,CAAC,MAAc,EAAE,MAAgB;QAC3C,MAAM,MAAM,GAAG,MA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