@ts-for-gir/lib 4.0.0-beta.18 → 4.0.0-beta.19
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/lib/generators/json.js +0 -1
- package/lib/generators/json.js.map +1 -1
- package/lib/generics/generify.js +2 -0
- package/lib/generics/generify.js.map +1 -1
- package/lib/generics/gtk.d.ts +7 -0
- package/lib/generics/gtk.js +56 -0
- package/lib/generics/gtk.js.map +1 -0
- package/lib/gir/base.js +2 -14
- package/lib/gir/base.js.map +1 -1
- package/lib/gir/class.js +1 -7
- package/lib/gir/class.js.map +1 -1
- package/lib/gir/registry.js +3 -0
- package/lib/gir/registry.js.map +1 -1
- package/lib/gir-module.js +0 -1
- package/lib/gir-module.js.map +1 -1
- package/lib/gir.d.ts +39 -39
- package/lib/gir.js +0 -4
- package/lib/gir.js.map +1 -1
- package/lib/injections/gio.js +72 -0
- package/lib/injections/gio.js.map +1 -1
- package/lib/injections/gtk4.d.ts +7 -0
- package/lib/injections/gtk4.js +19 -0
- package/lib/injections/gtk4.js.map +1 -0
- package/lib/injections/inject.js +2 -0
- package/lib/injections/inject.js.map +1 -1
- package/lib/utils/numbers.js +0 -1
- package/lib/utils/numbers.js.map +1 -1
- package/lib/utils/objects.js +0 -1
- package/lib/utils/objects.js.map +1 -1
- package/lib/validators/function-parameters.d.ts +14 -0
- package/lib/validators/function-parameters.js +31 -0
- package/lib/validators/function-parameters.js.map +1 -0
- package/package.json +7 -7
- package/lib/utils.d.ts +0 -267
- package/lib/utils.js +0 -417
- package/lib/utils.js.map +0 -1
package/lib/injections/inject.js
CHANGED
|
@@ -4,6 +4,7 @@ import gio from "./gio.js";
|
|
|
4
4
|
import tracker1 from "./tracker1.js";
|
|
5
5
|
import gee08 from "./gee08.js";
|
|
6
6
|
import gee1 from "./gee1.js";
|
|
7
|
+
import gtk4 from "./gtk4.js";
|
|
7
8
|
function injectDefinitions(registry, required = true) {
|
|
8
9
|
return (definition) => {
|
|
9
10
|
const ns = registry.namespace(definition.namespace, definition.version);
|
|
@@ -24,5 +25,6 @@ export function inject(registry) {
|
|
|
24
25
|
$_(tracker1);
|
|
25
26
|
$_(gee08);
|
|
26
27
|
$_(gee1);
|
|
28
|
+
$_(gtk4);
|
|
27
29
|
}
|
|
28
30
|
//# sourceMappingURL=inject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/injections/inject.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,SAAS,iBAAiB,CAAC,QAAoB,EAAE,QAAQ,GAAG,IAAI;IAC5D,OAAO,CAAC,UAAgF,EAAE,EAAE;QACxF,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAExE,IAAI,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,CAAC,SAAS,cAAc,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,EAAE,EAAE,CAAC;YACL,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,QAAoB;IACvC,MAAM,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAEtC,CAAC,CAAC,IAAI,CAAC,CAAC;IACR,CAAC,CAAC,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,GAAG,CAAC,CAAC;IAEP,MAAM,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE9C,EAAE,CAAC,QAAQ,CAAC,CAAC;IACb,EAAE,CAAC,KAAK,CAAC,CAAC;IACV,EAAE,CAAC,IAAI,CAAC,CAAC;AACb,CAAC"}
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/injections/inject.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,SAAS,iBAAiB,CAAC,QAAoB,EAAE,QAAQ,GAAG,IAAI;IAC5D,OAAO,CAAC,UAAgF,EAAE,EAAE;QACxF,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAExE,IAAI,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,CAAC,SAAS,cAAc,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,EAAE,EAAE,CAAC;YACL,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,QAAoB;IACvC,MAAM,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAEtC,CAAC,CAAC,IAAI,CAAC,CAAC;IACR,CAAC,CAAC,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,GAAG,CAAC,CAAC;IAEP,MAAM,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE9C,EAAE,CAAC,QAAQ,CAAC,CAAC;IACb,EAAE,CAAC,KAAK,CAAC,CAAC;IACV,EAAE,CAAC,IAAI,CAAC,CAAC;IACT,EAAE,CAAC,IAAI,CAAC,CAAC;AACb,CAAC"}
|
package/lib/utils/numbers.js
CHANGED
package/lib/utils/numbers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAW,EAAE;IAE9C,OAAO,CAAC,KAAK,CAAE,GAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;AACjD,CAAC,CAAA"}
|
package/lib/utils/objects.js
CHANGED
package/lib/utils/objects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;AAErC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;AAE7B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;AAEjC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAc,EAAW,EAAE;IAClD,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAA;AACpE,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAI,MAAoB,EAAE,MAAoB,EAAU,EAAE;IAC3E,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,CAAI,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;AACxD,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IntrospectedFunction, IntrospectedClassFunction } from "../gir/function.js";
|
|
2
|
+
import { IntrospectedBaseClass } from "../gir/class.js";
|
|
3
|
+
import { IntrospectedEnum } from "../gir/enum.js";
|
|
4
|
+
import { GirVisitor } from "../visitor.js";
|
|
5
|
+
export declare class FunctionParametersVisitor extends GirVisitor {
|
|
6
|
+
/**
|
|
7
|
+
* Marks all enum parameters of a function as nullable,
|
|
8
|
+
* because GJS allows null values for enum parameters and treats them as a 0 value.
|
|
9
|
+
* See issue [#207](https://github.com/gjsify/ts-for-gir/issues/207).
|
|
10
|
+
*/
|
|
11
|
+
private makeEnumParamsNullable;
|
|
12
|
+
visitFunction: (node: IntrospectedFunction) => IntrospectedFunction;
|
|
13
|
+
visitClassFunction: <T_1 extends IntrospectedBaseClass | IntrospectedEnum>(node: IntrospectedClassFunction<T_1>) => IntrospectedClassFunction<T_1>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TypeIdentifier, NullableType } from "../gir.js";
|
|
2
|
+
import { GirVisitor } from "../visitor.js";
|
|
3
|
+
export class FunctionParametersVisitor extends GirVisitor {
|
|
4
|
+
makeEnumParamsNullable(node) {
|
|
5
|
+
return node.copy({
|
|
6
|
+
parameters: node.parameters.map(param => {
|
|
7
|
+
const type = param.type.deepUnwrap();
|
|
8
|
+
if (type instanceof TypeIdentifier) {
|
|
9
|
+
// Get the namespace where this type should be defined
|
|
10
|
+
const ns = node.namespace.assertInstalledImport(type.namespace);
|
|
11
|
+
// Check if the type is an enum
|
|
12
|
+
const isEnumType = !!ns.getEnum(type.name);
|
|
13
|
+
// If it is, make the parameter nullable
|
|
14
|
+
if (isEnumType) {
|
|
15
|
+
return param.copy({
|
|
16
|
+
type: new NullableType(param.type)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return param;
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
visitFunction = (node) => {
|
|
25
|
+
return this.makeEnumParamsNullable(node);
|
|
26
|
+
};
|
|
27
|
+
visitClassFunction = (node) => {
|
|
28
|
+
return this.makeEnumParamsNullable(node);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=function-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-parameters.js","sourceRoot":"","sources":["../../src/validators/function-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,OAAO,yBAA0B,SAAQ,UAAU;IAU7C,sBAAsB,CAC1B,IAAsD;QAEtD,OAAO,IAAI,CAAC,IAAI,CAAC;YACb,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrC,IAAI,IAAI,YAAY,cAAc,EAAE,CAAC;oBACjC,sDAAsD;oBACtD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBAEhE,+BAA+B;oBAC/B,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAE3C,wCAAwC;oBACxC,IAAI,UAAU,EAAE,CAAC;wBACb,OAAO,KAAK,CAAC,IAAI,CAAC;4BACd,IAAI,EAAE,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;yBACrC,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;gBACD,OAAO,KAAK,CAAC;YACjB,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAED,aAAa,GAAG,CAAC,IAA0B,EAAwB,EAAE;QACjE,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC;IAEF,kBAAkB,GAAG,CACjB,IAAkC,EACN,EAAE;QAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC;CACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/lib",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.19",
|
|
4
4
|
"description": "Typescript .d.ts generator from GIR for gjs",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clear": "yarn clear:build",
|
|
21
21
|
"clear:build": "rimraf ./lib",
|
|
22
22
|
"watch": "yarn build:ts --watch",
|
|
23
|
-
"lint": "eslint . --
|
|
23
|
+
"lint": "eslint . --fix",
|
|
24
24
|
"update-package-descriptions": "wget https://raw.githubusercontent.com/vala-lang/valadoc-org/master/documentation/packages.xml"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
],
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/ejs": "^3.1.5",
|
|
54
|
-
"@types/eslint": "
|
|
54
|
+
"@types/eslint": "9.6.1",
|
|
55
55
|
"@types/lodash": "^4.17.13",
|
|
56
|
-
"@types/node": "^22.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
58
|
-
"@typescript-eslint/parser": "^8.
|
|
59
|
-
"eslint": "^
|
|
56
|
+
"@types/node": "^22.9.0",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
|
58
|
+
"@typescript-eslint/parser": "^8.13.0",
|
|
59
|
+
"eslint": "^9.14.0",
|
|
60
60
|
"eslint-config-prettier": "^9.1.0",
|
|
61
61
|
"eslint-plugin-prettier": "^5.2.1",
|
|
62
62
|
"prettier": "^3.3.3",
|
package/lib/utils.d.ts
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import lodash from 'lodash';
|
|
2
|
-
import { FileInfo } from './types/index.js';
|
|
3
|
-
import { inspect } from 'util';
|
|
4
|
-
export { inspect };
|
|
5
|
-
export declare const __filename: string;
|
|
6
|
-
export declare const __dirname: string;
|
|
7
|
-
/**
|
|
8
|
-
* Performs a deep comparison between two values to determine if they are
|
|
9
|
-
* equivalent.
|
|
10
|
-
*
|
|
11
|
-
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
12
|
-
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
13
|
-
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
14
|
-
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
15
|
-
* nodes are **not** supported.
|
|
16
|
-
*
|
|
17
|
-
* @category Lang
|
|
18
|
-
* @param value The value to compare.
|
|
19
|
-
* @param other The other value to compare.
|
|
20
|
-
* @returns Returns `true` if the values are equivalent, else `false`.
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* var object = { 'user': 'fred' };
|
|
24
|
-
* var other = { 'user': 'fred' };
|
|
25
|
-
*
|
|
26
|
-
* _.isEqual(object, other);
|
|
27
|
-
* // => true
|
|
28
|
-
*
|
|
29
|
-
* object === other;
|
|
30
|
-
* // => false
|
|
31
|
-
*/
|
|
32
|
-
export declare const isEqual: (value: any, other: any) => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Creates an array of values by running each element in collection through iteratee. The iteratee is
|
|
35
|
-
* invoked with three arguments: (value, index|key, collection).
|
|
36
|
-
*
|
|
37
|
-
* Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues,
|
|
38
|
-
* _.reject, and _.some.
|
|
39
|
-
*
|
|
40
|
-
* The guarded methods are:
|
|
41
|
-
* ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max,
|
|
42
|
-
* min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range,
|
|
43
|
-
* sample, some, sum, uniq, and words
|
|
44
|
-
*
|
|
45
|
-
* @param collection The collection to iterate over.
|
|
46
|
-
* @param iteratee The function invoked per iteration.
|
|
47
|
-
* @return Returns the new mapped array.
|
|
48
|
-
*/
|
|
49
|
-
export declare const map: {
|
|
50
|
-
<T, TResult>(collection: T[] | null | undefined, iteratee: lodash.ArrayIterator<T, TResult>): TResult[];
|
|
51
|
-
<T, TResult>(collection: lodash.List<T> | null | undefined, iteratee: lodash.ListIterator<T, TResult>): TResult[];
|
|
52
|
-
<T>(collection: lodash.Dictionary<T> | lodash.NumericDictionary<T> | null | undefined): T[];
|
|
53
|
-
<T extends object, TResult>(collection: T | null | undefined, iteratee: lodash.ObjectIterator<T, TResult>): TResult[];
|
|
54
|
-
<T, K extends keyof T>(collection: lodash.Dictionary<T> | lodash.NumericDictionary<T> | null | undefined, iteratee: K): Array<T[K]>;
|
|
55
|
-
<T>(collection: lodash.Dictionary<T> | lodash.NumericDictionary<T> | null | undefined, iteratee?: string): any[];
|
|
56
|
-
<T>(collection: lodash.Dictionary<T> | lodash.NumericDictionary<T> | null | undefined, iteratee?: object): boolean[];
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Iterates over elements of collection, returning the first element predicate returns truthy for.
|
|
60
|
-
* The predicate is invoked with three arguments: (value, index|key, collection).
|
|
61
|
-
*
|
|
62
|
-
* @param collection The collection to search.
|
|
63
|
-
* @param predicate The function invoked per iteration.
|
|
64
|
-
* @param fromIndex The index to search from.
|
|
65
|
-
* @return Returns the matched element, else undefined.
|
|
66
|
-
*/
|
|
67
|
-
export declare const find: {
|
|
68
|
-
<T, S extends T>(collection: lodash.List<T> | null | undefined, predicate: lodash.ListIteratorTypeGuard<T, S>, fromIndex?: number): S | undefined;
|
|
69
|
-
<T>(collection: lodash.List<T> | null | undefined, predicate?: lodash.ListIterateeCustom<T, boolean>, fromIndex?: number): T | undefined;
|
|
70
|
-
<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: lodash.ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S | undefined;
|
|
71
|
-
<T extends object>(collection: T | null | undefined, predicate?: lodash.ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T] | undefined;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Recursively merges own and inherited enumerable properties of source
|
|
75
|
-
* objects into the destination object, skipping source properties that resolve
|
|
76
|
-
* to `undefined`. Array and plain object properties are merged recursively.
|
|
77
|
-
* Other objects and value types are overridden by assignment. Source objects
|
|
78
|
-
* are applied from left to right. Subsequent sources overwrite property
|
|
79
|
-
* assignments of previous sources.
|
|
80
|
-
*
|
|
81
|
-
* **Note:** This method mutates `object`.
|
|
82
|
-
*
|
|
83
|
-
* @category Object
|
|
84
|
-
* @param object The destination object.
|
|
85
|
-
* @param [sources] The source objects.
|
|
86
|
-
* @returns Returns `object`.
|
|
87
|
-
* @example
|
|
88
|
-
*
|
|
89
|
-
* var users = {
|
|
90
|
-
* 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
|
|
91
|
-
* };
|
|
92
|
-
*
|
|
93
|
-
* var ages = {
|
|
94
|
-
* 'data': [{ 'age': 36 }, { 'age': 40 }]
|
|
95
|
-
* };
|
|
96
|
-
*
|
|
97
|
-
* _.merge(users, ages);
|
|
98
|
-
* // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
|
|
99
|
-
*/
|
|
100
|
-
export declare const merge: {
|
|
101
|
-
<TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
|
|
102
|
-
<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2;
|
|
103
|
-
<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TObject & TSource1 & TSource2 & TSource3;
|
|
104
|
-
<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TObject & TSource1 & TSource2 & TSource3 & TSource4;
|
|
105
|
-
(object: any, ...otherArgs: any[]): any;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Creates a shallow clone of value.
|
|
109
|
-
*
|
|
110
|
-
* Note: This method is loosely based on the structured clone algorithm and supports cloning arrays,
|
|
111
|
-
* array buffers, booleans, date objects, maps, numbers, Object objects, regex's, sets, strings, symbols,
|
|
112
|
-
* and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty
|
|
113
|
-
* object is returned for not cloneable values such as error objects, functions, DOM nodes, and WeakMaps.
|
|
114
|
-
*
|
|
115
|
-
* @param value The value to clone.
|
|
116
|
-
* @return Returns the cloned value.
|
|
117
|
-
*/
|
|
118
|
-
export declare const clone: <T>(value: T) => T;
|
|
119
|
-
/**
|
|
120
|
-
* This method is like clone except that it recursively clones value.
|
|
121
|
-
*
|
|
122
|
-
* @param value The value to recursively clone.
|
|
123
|
-
* @return Returns the deep cloned value.
|
|
124
|
-
*/
|
|
125
|
-
export declare const cloneDeep: <T>(value: T) => T;
|
|
126
|
-
/**
|
|
127
|
-
* Split a package name into namespace and version
|
|
128
|
-
*/
|
|
129
|
-
export declare const splitModuleName: (packageName: string) => {
|
|
130
|
-
packageName: string;
|
|
131
|
-
namespace: string;
|
|
132
|
-
version: string;
|
|
133
|
-
};
|
|
134
|
-
/** Remove namespace prefix */
|
|
135
|
-
export declare const removeNamespace: (type: string, namespace: string) => string;
|
|
136
|
-
/** Remove class module name prefix */
|
|
137
|
-
export declare const removeClassModule: (type: string, namespace: string) => string;
|
|
138
|
-
/**
|
|
139
|
-
* Add namespace prefix
|
|
140
|
-
*/
|
|
141
|
-
export declare const addNamespace: (type: string, namespace: string) => string;
|
|
142
|
-
/**
|
|
143
|
-
* Removes line breaks and consecutive white spaces from a given string
|
|
144
|
-
* @param str
|
|
145
|
-
* @returns
|
|
146
|
-
*/
|
|
147
|
-
export declare const cleanString: (str: string) => string;
|
|
148
|
-
/**
|
|
149
|
-
* Checking whether some variable is iterable
|
|
150
|
-
* @see https://stackoverflow.com/a/32538867
|
|
151
|
-
* @param obj Variable to check for iterable
|
|
152
|
-
* @returns Whether the variable is iterable or not
|
|
153
|
-
*/
|
|
154
|
-
export declare const isIterable: (obj: unknown[]) => boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Checking whether a string is numeric
|
|
157
|
-
* @param str The string to check
|
|
158
|
-
* @returns Whether the string is numeric or not
|
|
159
|
-
*/
|
|
160
|
-
export declare const isNumeric: (str: string) => boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Get the first character of a string
|
|
163
|
-
* @param str The string to get the first character from
|
|
164
|
-
* @returns The first character
|
|
165
|
-
*/
|
|
166
|
-
export declare const getFirstChar: (str: string) => string;
|
|
167
|
-
/**
|
|
168
|
-
* Get the last character of a string
|
|
169
|
-
* @param str The string to get the last character from
|
|
170
|
-
* @returns The last character
|
|
171
|
-
*/
|
|
172
|
-
export declare const getLastChar: (str: string) => string;
|
|
173
|
-
/**
|
|
174
|
-
* Check if the first character of a string is numeric
|
|
175
|
-
* @param str The string to check
|
|
176
|
-
* @returns Whether the first character is numeric or not
|
|
177
|
-
*/
|
|
178
|
-
export declare const isFirstCharNumeric: (str: string) => boolean;
|
|
179
|
-
/**
|
|
180
|
-
* Convert a string to camelCase, keeps the first alphabet character as it is.
|
|
181
|
-
* @param str The string to convert
|
|
182
|
-
* @returns The converted string
|
|
183
|
-
*/
|
|
184
|
-
export declare const camelCase: (str: string) => string;
|
|
185
|
-
/**
|
|
186
|
-
* Convert a string to `lowerCamelCase`
|
|
187
|
-
* @param str The string to convert
|
|
188
|
-
* @returns The converted string
|
|
189
|
-
*/
|
|
190
|
-
export declare const lowerCamelCase: (str: string) => string;
|
|
191
|
-
/**
|
|
192
|
-
* Convert a string to `PascalCase`
|
|
193
|
-
* @param str The string to convert
|
|
194
|
-
* @returns The converted string
|
|
195
|
-
*/
|
|
196
|
-
export declare const pascalCase: (str: string) => string;
|
|
197
|
-
/** Alias for {@link pascalCase} */
|
|
198
|
-
export declare const upperCamelCase: (str: string) => string;
|
|
199
|
-
/**
|
|
200
|
-
* Convert a string to `snake_case`
|
|
201
|
-
* @param str The string to convert
|
|
202
|
-
* @returns The converted string
|
|
203
|
-
*/
|
|
204
|
-
export declare const snakeCase: (str: string) => string;
|
|
205
|
-
/**
|
|
206
|
-
* Convert a string to `kebab-case`
|
|
207
|
-
* @param str The string to convert
|
|
208
|
-
* @returns The converted string
|
|
209
|
-
*/
|
|
210
|
-
export declare const kebabCase: (str: string) => string;
|
|
211
|
-
/** Alias for {@link kebabCase} */
|
|
212
|
-
export declare const slugCase: (str: string) => string;
|
|
213
|
-
export declare const underscores: (str: string) => string;
|
|
214
|
-
/**
|
|
215
|
-
* Find a file in a list of directories
|
|
216
|
-
* @param dirs The directories to search in
|
|
217
|
-
* @param filename The filename to search for
|
|
218
|
-
* @returns The file info
|
|
219
|
-
*/
|
|
220
|
-
export declare const findFilesInDirs: (dirs: string[], filename: string) => Promise<FileInfo[]>;
|
|
221
|
-
/**
|
|
222
|
-
* Find a file in a list of directories (sync)
|
|
223
|
-
* @param dirs The directories to search in
|
|
224
|
-
* @param filename The filename to search for
|
|
225
|
-
* @returns The file info
|
|
226
|
-
*/
|
|
227
|
-
export declare const findFilesInDirsSync: (dirs: string[], filename: string) => FileInfo[];
|
|
228
|
-
/**
|
|
229
|
-
* Read a JSON file
|
|
230
|
-
* @param filePath The path to the JSON file
|
|
231
|
-
* @returns The parsed JSON
|
|
232
|
-
*/
|
|
233
|
-
export declare const readJsonFile: <T = unknown>(filePath: string) => Promise<T>;
|
|
234
|
-
/**
|
|
235
|
-
* Union (a ∪ b): create a set that contains the elements of both set a and set b.
|
|
236
|
-
* See https://2ality.com/2015/01/es6-set-operations.html#union
|
|
237
|
-
* @param target
|
|
238
|
-
* @param source
|
|
239
|
-
*/
|
|
240
|
-
export declare const union: <T>(target: Set<T> | T[], source: Set<T> | T[]) => Set<T>;
|
|
241
|
-
export declare const stripParamNames: (func: string, ignoreTail?: boolean) => string;
|
|
242
|
-
/**
|
|
243
|
-
* Check if a line is a comment line
|
|
244
|
-
* @param line The line to check
|
|
245
|
-
* @returns Whether the line is a comment line or not
|
|
246
|
-
*/
|
|
247
|
-
export declare const isCommentLine: (line: string) => boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Add indents to a string
|
|
250
|
-
* @param indents The number of indents
|
|
251
|
-
* @param spaceForIndent The number of spaces for each indent
|
|
252
|
-
* @returns The indented string
|
|
253
|
-
*/
|
|
254
|
-
export declare const generateIndent: (indents?: number, spaceForIndent?: number) => string;
|
|
255
|
-
/**
|
|
256
|
-
* Convert a GirBoolean to a boolean
|
|
257
|
-
* @param boolStr The GirBoolean string
|
|
258
|
-
* @param defaultVal The default value
|
|
259
|
-
* @returns The boolean value
|
|
260
|
-
*/
|
|
261
|
-
export declare const girBool: (boolStr: string | undefined, defaultVal?: boolean) => boolean;
|
|
262
|
-
/**
|
|
263
|
-
* Returns `true` if the definitions in `d1` and `d2` have equivalent signatures
|
|
264
|
-
* @param d1
|
|
265
|
-
* @param d2
|
|
266
|
-
*/
|
|
267
|
-
export declare const signaturesMatch: (d1: string, d2: string) => boolean;
|