lucid-extension-sdk 0.0.277 → 0.0.278

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/core/checks.d.ts CHANGED
@@ -121,6 +121,14 @@ export type Tuple<T, N extends number> = N extends N ? (number extends N ? T[] :
121
121
  type TupleOfHelper<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : TupleOfHelper<T, N, [T, ...R]>;
122
122
  export declare function isExactLength<T, N extends number>(arr: T[], exactLength: N): arr is Tuple<T, N>;
123
123
  export declare function isAtLeastLength<T, N extends number>(arr: T[], minimumLength: N): arr is [...Tuple<T, N>, ...T[]];
124
+ /**
125
+ * Returns true if the specified value is a tuple where the first element, T, passes the tGuard function
126
+ * and the second element, U, passes the uGuard function
127
+ * @param tGuard the type guard function to test the first element in the tuple, T
128
+ * @param uGuard the type guard function to test the second element in the tuple, U
129
+ * @returns whether the value is a tuple of the form [T, U]
130
+ */
131
+ export declare function isPair<T, U>(tGuard: (x: unknown) => x is T, uGuard: (x: unknown) => x is U): (x: unknown) => x is [T, U];
124
132
  /**
125
133
  * Returns true if the specified object is either empty or all existing keys map to a nullish value
126
134
  *
package/core/checks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isAtLeastLength = exports.isExactLength = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObjectUnsafer = exports.isObjectUnsafe = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isVoid = exports.isUndefined = exports.isNull = exports.isDef = void 0;
3
+ exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isPair = exports.isAtLeastLength = exports.isExactLength = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObjectUnsafer = exports.isObjectUnsafe = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isVoid = exports.isUndefined = exports.isNull = exports.isDef = void 0;
4
4
  /**
5
5
  * Returns true if the specified value is not undefined.
6
6
  *
@@ -185,6 +185,19 @@ function isAtLeastLength(arr, minimumLength) {
185
185
  return arr.length >= minimumLength;
186
186
  }
187
187
  exports.isAtLeastLength = isAtLeastLength;
188
+ /**
189
+ * Returns true if the specified value is a tuple where the first element, T, passes the tGuard function
190
+ * and the second element, U, passes the uGuard function
191
+ * @param tGuard the type guard function to test the first element in the tuple, T
192
+ * @param uGuard the type guard function to test the second element in the tuple, U
193
+ * @returns whether the value is a tuple of the form [T, U]
194
+ */
195
+ function isPair(tGuard, uGuard) {
196
+ return (x) => {
197
+ return isArray(x) && isExactLength(x, 2) && tGuard(x[0]) && uGuard(x[1]);
198
+ };
199
+ }
200
+ exports.isPair = isPair;
188
201
  /**
189
202
  * Returns true if the specified object is either empty or all existing keys map to a nullish value
190
203
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.277",
3
+ "version": "0.0.278",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",