@cslug/validation 0.1.0 → 0.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cslug/validation",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Schemas and validators (Zod-like API, Standard Schema, JSON Schema export).",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -4,6 +4,7 @@ export const settings = {
4
4
  today: (): string => new Date().toISOString().slice(0, 10),
5
5
  }
6
6
 
7
+ /** Replace the hooks in `settings` (called by @cslug/core at boot). */
7
8
  export function configure(options: Partial<typeof settings>): void {
8
9
  Object.assign(settings, options)
9
10
  }
package/src/domain.ts CHANGED
@@ -157,6 +157,7 @@ export class PhoneSchema extends Schema<string> {
157
157
  // ── uploaded file ───────────────────────────────────────────────────────────────────────────────────
158
158
  const SIZE = /^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)$/i
159
159
  const UNITS: Record<string, number> = { b: 1, kb: 1024, mb: 1024 ** 2, gb: 1024 ** 3 }
160
+ /** `'2mb'` → 2097152 bytes (b, kb, mb, gb; powers of 1024). */
160
161
  export const parseSize = (size: string | number): number => {
161
162
  if (typeof size === 'number') return size
162
163
  const [, amount, unit] = SIZE.exec(size.trim()) ?? []