@thi.ng/api
Advanced tools
Comparing version 8.6.3 to 8.7.0
# Change Log | ||
- **Last updated**: 2023-01-10T15:20:18Z | ||
- **Last updated**: 2023-02-05T14:42:21Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
## [8.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.7.0) (2023-02-05) | ||
#### 🚀 Features | ||
- add narrow/widenType() fns ([5ce9938](https://github.com/thi-ng/umbrella/commit/5ce9938)) | ||
## [8.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.6.0) (2022-12-16) | ||
@@ -14,0 +20,0 @@ |
{ | ||
"name": "@thi.ng/api", | ||
"version": "8.6.3", | ||
"version": "8.7.0", | ||
"description": "Common, generic types, interfaces & mixins", | ||
@@ -40,8 +40,8 @@ "type": "module", | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.33.7", | ||
"@thi.ng/testament": "^0.3.9", | ||
"rimraf": "^3.0.2", | ||
"@microsoft/api-extractor": "^7.34.2", | ||
"@thi.ng/testament": "^0.3.10", | ||
"rimraf": "^4.1.2", | ||
"tools": "^0.0.1", | ||
"typedoc": "^0.23.22", | ||
"typescript": "^4.9.4" | ||
"typedoc": "^0.23.24", | ||
"typescript": "^4.9.5" | ||
}, | ||
@@ -229,3 +229,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "3f0b3e2a7c82aefc7e46fb4338369836b5e1b8cf\n" | ||
"gitHead": "50ba9c87676fac60c46d2bc0e4d2c7711a374a68\n" | ||
} |
@@ -194,2 +194,61 @@ export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>; | ||
export declare const intTypeForBits: (x: number) => IntType; | ||
/** | ||
* Returns the next smaller {@link IntType} for given type (or the same type if | ||
* already the narrowest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const narrowInt: (t: IntType | "i64") => "i32" | "i8" | "i16"; | ||
/** | ||
* Returns the next larger {@link IntType} for given type (or the same type if | ||
* already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const widenInt: (t: IntType) => "i32" | "i64" | "i16"; | ||
/** | ||
* Returns the next smaller {@link UintType} for given type (or the same type if | ||
* already the narrowest). | ||
* | ||
* @remarks | ||
* If type is `u8c`, returns `u8`. | ||
* | ||
* @param t | ||
*/ | ||
export declare const narrowUint: (t: UintType | "u64") => "u8" | "u16" | "u32"; | ||
/** | ||
* Returns the next larger {@link UintType} for given type (or the same type if | ||
* already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const widenUint: (t: UintType) => "u16" | "u32" | "u64"; | ||
/** | ||
* Returns the next smaller {@link FloatType} for given type (or the same type | ||
* if already the narrowest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const narrowFloat: (t: FloatType) => string; | ||
/** | ||
* Returns the next larger {@link FloatType} for given type (or the same type if | ||
* already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const widenFloat: (t: FloatType) => string; | ||
/** | ||
* Returns the next smaller type (i.e. {@link IntType}, {@link UintType} or | ||
* {@link FloatType}) for given type (or the same type if already the smallest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const narrowType: (t: Type | BigType) => string; | ||
/** | ||
* Returns the next larger type (i.e. {@link IntType}, {@link UintType} or | ||
* {@link FloatType}) for given type (or the same type if already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export declare const widenType: (t: Type | BigType) => string; | ||
//# sourceMappingURL=typedarray.d.ts.map |
@@ -193,1 +193,74 @@ /** | ||
export const intTypeForBits = (x) => x > 16 ? "i32" : x > 8 ? "i16" : "i8"; | ||
/** | ||
* Returns the next smaller {@link IntType} for given type (or the same type if | ||
* already the narrowest). | ||
* | ||
* @param t | ||
*/ | ||
export const narrowInt = (t) => t === "i64" ? "i32" : t === "i32" ? "i16" : t === "i16" ? "i8" : "i8"; | ||
/** | ||
* Returns the next larger {@link IntType} for given type (or the same type if | ||
* already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export const widenInt = (t) => t === "i8" ? "i16" : t === "i16" ? "i32" : t === "i32" ? "i64" : "i64"; | ||
/** | ||
* Returns the next smaller {@link UintType} for given type (or the same type if | ||
* already the narrowest). | ||
* | ||
* @remarks | ||
* If type is `u8c`, returns `u8`. | ||
* | ||
* @param t | ||
*/ | ||
export const narrowUint = (t) => t === "u64" ? "u32" : t === "u32" ? "u16" : t === "u16" ? "u8" : "u8"; | ||
/** | ||
* Returns the next larger {@link UintType} for given type (or the same type if | ||
* already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export const widenUint = (t) => t === "u8" || t === "u8c" | ||
? "u16" | ||
: t === "u16" | ||
? "u32" | ||
: t === "u32" | ||
? "u64" | ||
: "u64"; | ||
/** | ||
* Returns the next smaller {@link FloatType} for given type (or the same type | ||
* if already the narrowest). | ||
* | ||
* @param t | ||
*/ | ||
export const narrowFloat = (t) => (t === "f64" ? "f32" : "f32"); | ||
/** | ||
* Returns the next larger {@link FloatType} for given type (or the same type if | ||
* already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export const widenFloat = (t) => (t === "f32" ? "f64" : "f64"); | ||
/** | ||
* Returns the next smaller type (i.e. {@link IntType}, {@link UintType} or | ||
* {@link FloatType}) for given type (or the same type if already the smallest). | ||
* | ||
* @param t | ||
*/ | ||
export const narrowType = (t) => t[0] === "i" | ||
? narrowInt(t) | ||
: t[0] === "u" | ||
? narrowUint(t) | ||
: narrowFloat(t); | ||
/** | ||
* Returns the next larger type (i.e. {@link IntType}, {@link UintType} or | ||
* {@link FloatType}) for given type (or the same type if already the widest). | ||
* | ||
* @param t | ||
*/ | ||
export const widenType = (t) => t[0] === "i" | ||
? widenInt(t) | ||
: t[0] === "u" | ||
? widenUint(t) | ||
: widenFloat(t); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125739
115
2533