@travetto/base
Advanced tools
Comparing version 4.0.6 to 4.1.0
{ | ||
"name": "@travetto/base", | ||
"version": "4.0.6", | ||
"version": "4.1.0", | ||
"description": "Environment config and common utilities for travetto applications.", | ||
@@ -27,9 +27,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/manifest": "^4.0.3", | ||
"@travetto/manifest": "^4.1.0", | ||
"@types/debug": "^4.1.12", | ||
"@types/node": "^20.11.25", | ||
"@types/node": "^20.12.12", | ||
"debug": "^4.3.4" | ||
}, | ||
"peerDependencies": { | ||
"@travetto/transformer": "^4.0.4" | ||
"@travetto/transformer": "^4.1.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependenciesMeta": { |
@@ -50,3 +50,3 @@ export type ErrorCategory = | ||
this.type = this.constructor.name; | ||
this.stack = stack || this.stack; // eslint-disable-line no-self-assign | ||
this.stack = stack || this.stack; | ||
this.details = details!; | ||
@@ -53,0 +53,0 @@ } |
@@ -6,2 +6,3 @@ import rl from 'node:readline/promises'; | ||
import { pipeline } from 'node:stream/promises'; | ||
import { AppError } from './error'; | ||
@@ -105,2 +106,17 @@ type All = Buffer | string | Readable | Uint8Array | NodeJS.ReadableStream | WebReadableStream; | ||
} | ||
/** | ||
* Enforce byte range for stream stream/file of a certain size | ||
*/ | ||
static enforceRange(start: number, end: number | undefined, size: number): [start: number, end: number] { | ||
end ??= size - 1; | ||
if (Number.isNaN(start) || Number.isNaN(end) || !Number.isFinite(start) || start >= size || start < 0) { | ||
throw new AppError('Invalid position, out of range', 'data'); | ||
} | ||
if (end >= size) { | ||
end = size - 1; | ||
} | ||
return [start, end]; | ||
} | ||
} |
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
57844
1145
Updated@travetto/manifest@^4.1.0
Updated@types/node@^20.12.12