--- spec: openflange.org/pipe/v0.1 id: parse-duration version: 0.1.0 title: Parse duration description: Converts human-readable durations ("2 days", "1.5h") to milliseconds using the npm package `ms`. license: Apache-2.0 keywords: [npm, node, javascript, duration, time, wrapper, example] maturity: experimental scope: record cardinality: one-to-one deterministic: true inputs: text: description: Durations as text, one JSON string per NDJSON line. schema: format: json-schema definition: {type: string} outputs: durations: description: 'One record per input, in order: {"text", "ms"}. `ms` is null when the text is not a duration.' schema: format: json-schema definition: type: object required: [text, ms] properties: text: {type: string} ms: {type: [number, "null"]} implementation: type: script language: node path: parse-duration.js permissions: subprocess: true --- # Parse duration Implements the [OpenFlange](https://openflange.org/) specification. A thin wrapper that turns an existing npm package — [`ms`](https://www.npmjs.com/package/ms) 2.1.3 (MIT, no dependencies) — into a pipe. See [README.md](README.md) for input → command → output. - Install the dependency first with `npm ci --ignore-scripts` (exact version and integrity hash come from the committed `package-lock.json`; package lifecycle scripts are never run). Without `node_modules` the run fails with `E_RUNTIME` ("Cannot find module 'ms'"). - Text that is not a duration is answered with `"ms": null` — explicit data, not a dropped record. A non-string item fails the run (`E_RUNTIME`). - This manifest's licence (Apache-2.0) covers the wrapper; `ms` keeps its own licence (MIT). Permissions: `subprocess` (it starts `node`). No network at run time, no files.