libram 0.3.1 → 0.4.1
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/Kmail.d.ts +10 -6
- package/dist/Kmail.js +17 -7
- package/dist/combat.d.ts +2 -1
- package/dist/combat.js +3 -2
- package/dist/diet/index.d.ts +16 -0
- package/dist/diet/index.js +439 -0
- package/dist/diet/knapsack.d.ts +7 -0
- package/dist/diet/knapsack.js +116 -0
- package/dist/freerun.d.ts +11 -0
- package/dist/freerun.js +103 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +38 -1
- package/dist/lib.d.ts +41 -0
- package/dist/lib.js +144 -2
- package/dist/maximize.d.ts +29 -12
- package/dist/maximize.js +264 -94
- package/dist/modifier.d.ts +13 -0
- package/dist/modifier.js +46 -0
- package/dist/modifierTypes.d.ts +16 -0
- package/dist/modifierTypes.js +23 -0
- package/dist/propertyTypes.d.ts +9 -0
- package/dist/propertyTypes.js +0 -0
- package/dist/propertyTyping.d.ts +2 -9
- package/dist/resources/2010/CrownOfThrones.d.ts +9 -0
- package/dist/resources/2010/CrownOfThrones.js +374 -0
- package/dist/resources/2013/Florist.d.ts +60 -0
- package/dist/resources/2013/Florist.js +219 -0
- package/dist/resources/2015/MayoClinic.d.ts +12 -0
- package/dist/resources/2015/MayoClinic.js +71 -0
- package/dist/resources/2019/BeachComb.d.ts +2 -0
- package/dist/resources/2019/BeachComb.js +44 -0
- package/dist/resources/index.d.ts +16 -11
- package/dist/resources/index.js +45 -25
- package/dist/ring-buffer.d.ts +24 -0
- package/dist/ring-buffer.js +135 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.js +34 -0
- package/package.json +4 -2
- package/dist/libram-example-briefcase.js +0 -16073
- package/dist/libram-example-clan.js +0 -8898
- package/dist/libram-example-consult.js +0 -6179
- package/dist/libram-example-item.js +0 -3248
- package/dist/libram-example-kmail.js +0 -2065
- package/dist/libram-example-lib.js +0 -7608
- package/dist/libram-example-props.js +0 -4770
- package/dist/libram-example-resources.js +0 -12226
package/dist/utils.d.ts
CHANGED
|
@@ -25,3 +25,17 @@ export declare function countedMapToString<T>(map: Map<T, number>): string;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function sum<T>(addends: T[], mappingFunction: (element: T) => number): number;
|
|
27
27
|
export declare function sumNumbers(addends: number[]): number;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a given item is in a readonly array, acting as a typeguard.
|
|
30
|
+
* @param item Needle
|
|
31
|
+
* @param array Readonly array haystack
|
|
32
|
+
* @returns Whether the item is in the array, and narrows the type of the item.
|
|
33
|
+
*/
|
|
34
|
+
export declare function arrayContains<T, A extends T>(item: T, array: ReadonlyArray<A>): item is A;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if two arrays contain the same elements in the same quantity.
|
|
37
|
+
* @param a First array for comparison
|
|
38
|
+
* @param b Second array for comparison
|
|
39
|
+
* @returns Whether the two arrays are equal, irrespective of order.
|
|
40
|
+
*/
|
|
41
|
+
export declare function setEqual<T>(a: T[], b: T[]): boolean;
|
package/dist/utils.js
CHANGED
|
@@ -16,6 +16,8 @@ exports.countedMapToArray = countedMapToArray;
|
|
|
16
16
|
exports.countedMapToString = countedMapToString;
|
|
17
17
|
exports.sum = sum;
|
|
18
18
|
exports.sumNumbers = sumNumbers;
|
|
19
|
+
exports.arrayContains = arrayContains;
|
|
20
|
+
exports.setEqual = setEqual;
|
|
19
21
|
|
|
20
22
|
require("core-js/modules/es.number.parse-int.js");
|
|
21
23
|
|
|
@@ -39,6 +41,12 @@ require("core-js/modules/es.array.map.js");
|
|
|
39
41
|
|
|
40
42
|
require("core-js/modules/es.array.concat.js");
|
|
41
43
|
|
|
44
|
+
require("core-js/modules/es.array.includes.js");
|
|
45
|
+
|
|
46
|
+
require("core-js/modules/es.string.includes.js");
|
|
47
|
+
|
|
48
|
+
require("core-js/modules/es.array.sort.js");
|
|
49
|
+
|
|
42
50
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
51
|
|
|
44
52
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -137,4 +145,30 @@ function sum(addends, mappingFunction) {
|
|
|
137
145
|
|
|
138
146
|
function sumNumbers(addends) {
|
|
139
147
|
return sum(addends, x => x);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Checks if a given item is in a readonly array, acting as a typeguard.
|
|
151
|
+
* @param item Needle
|
|
152
|
+
* @param array Readonly array haystack
|
|
153
|
+
* @returns Whether the item is in the array, and narrows the type of the item.
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
function arrayContains(item, array) {
|
|
158
|
+
return array.includes(item);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Checks if two arrays contain the same elements in the same quantity.
|
|
162
|
+
* @param a First array for comparison
|
|
163
|
+
* @param b Second array for comparison
|
|
164
|
+
* @returns Whether the two arrays are equal, irrespective of order.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
function setEqual(a, b) {
|
|
169
|
+
var sortedA = _toConsumableArray(a).sort();
|
|
170
|
+
|
|
171
|
+
var sortedB = _toConsumableArray(b).sort();
|
|
172
|
+
|
|
173
|
+
return a.length === b.length && sortedA.every((item, index) => item === sortedB[index]);
|
|
140
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libram",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "JavaScript helper library for KoLmafia",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,8 +37,10 @@
|
|
|
37
37
|
"babel-loader": "^8.2.2",
|
|
38
38
|
"eslint": "^7.16.0",
|
|
39
39
|
"eslint-config-prettier": "^8.3.0",
|
|
40
|
+
"eslint-plugin-import": "^2.24.2",
|
|
40
41
|
"eslint-plugin-libram": "^0.1.9",
|
|
41
42
|
"husky": "^4.3.6",
|
|
43
|
+
"java-parser": "^1.4.0",
|
|
42
44
|
"lint-staged": ">=10",
|
|
43
45
|
"node-fetch": "^2.6.1",
|
|
44
46
|
"prettier": "^2.1.2",
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"dependencies": {
|
|
52
54
|
"@babel/runtime-corejs3": "^7.14.9",
|
|
53
55
|
"core-js": "3.15.2",
|
|
54
|
-
"kolmafia": "^1.
|
|
56
|
+
"kolmafia": "^1.3.0",
|
|
55
57
|
"lodash": "^4.17.21"
|
|
56
58
|
},
|
|
57
59
|
"husky": {
|