{"library":"stream-transform","title":"Stream Transform","type":"library","description":"Stream-transform is a robust JavaScript library designed for object transformations, implementing the Node.js `stream.Transform` API. It is a core component of the broader `node-csv` project, currently at version 3.4.1. This library offers flexible APIs, including stream-based for high scalability, and convenient callback-based and synchronous options for simpler use cases. Key differentiators include its adherence to the native Node.js stream interface, support for both synchronous and asynchronous user functions, and capabilities for sequential or concurrent execution. It can process various input and output types such as objects, arrays, and JSON, enabling operations like skipping, multiplying, altering, or cloning records. While an explicit release cadence isn't stated, its inclusion in the actively maintained `node-csv` project implies regular updates and support.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install stream-transform"],"cli":null},"imports":["import { transform } from 'stream-transform/sync';","import { transform } from 'stream-transform';","import { Transformer } from 'stream-transform';","import { transform as transformCallback } from 'stream-transform/callback';"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://csv.js.org/transform","github":"https://github.com/adaltas/node-csv","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/stream-transform","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { transform } from \"stream-transform/sync\";\nimport assert from \"node:assert\";\n\nconst inputRecords = [\n  [\"a\", \"b\", \"c\", \"d\"],\n  [\"1\", \"2\", \"3\", \"4\"],\n  [\"x\", \"y\", \"z\", \"w\"]\n];\n\nconst transformedRecords = transform(\n  inputRecords,\n  function (record) {\n    // Example transformation: move the first element to the end\n    record.push(record.shift());\n    return record;\n  },\n  // Optional options object can be passed here\n  { objectMode: true } // Assuming objectMode for array records\n);\n\nassert.deepEqual(transformedRecords, [\n  [\"b\", \"c\", \"d\", \"a\"],\n  [\"2\", \"3\", \"4\", \"1\"],\n  [\"y\", \"z\", \"w\", \"x\"]\n]);\n\nconsole.log(\"Transformation successful:\", transformedRecords);","lang":"typescript","description":"This quickstart demonstrates the synchronous transformation API. It takes an array of arrays (records), applies a function to each record to shift its elements, and asserts the output. This API is suitable for smaller datasets that can be processed in memory.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}