Modules@robinpath/transform

@robinpath/transform

0.1.0Public

Data transformation and mapping utilities for RobinPath

@robinpath/transform

Data transformation and mapping utilities: pick, omit, rename, coerce, flatten, merge, pipeline, and more

Category Functions Auth License

Why use this module?

The transform module lets you:

  • Pick specific keys from an object (supports nested paths with dot notation)
  • Create a copy of an object with specific keys removed
  • Rename keys in an object
  • Apply transformations to specific values in an object
  • Coerce a value to a target type

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/transform

Quick Start

No credentials needed — start using it right away:

transform.omit $data ["password", "secret"]

Available Functions

FunctionDescription
transform.pickPick specific keys from an object (supports nested paths with dot notation)
transform.omitCreate a copy of an object with specific keys removed
transform.renameRename keys in an object
transform.mapValuesApply transformations to specific values in an object
transform.coerceCoerce a value to a target type
transform.flattenFlatten a nested object into a single level with dot-notation keys
transform.unflattenUnflatten a dot-notation object back into a nested structure
transform.mergeDeep merge multiple objects (later objects override earlier ones)
transform.defaultsFill in missing/null/undefined keys from default values
transform.templateRender a template string with {{key}} placeholders replaced by data values
transform.groupGroup an array of objects by a key value
transform.pipelineApply a series of transformation steps to data
transform.mapArrayMap an array of objects to a new shape by specifying target-to-source key mapping
transform.filterFilter an array of objects by matching key-value conditions
transform.sortSort an array of objects by a key

Examples

Create a copy of an object with specific keys removed

transform.omit $data ["password", "secret"]

Rename keys in an object

transform.rename $data {"firstName": "first_name", "lastName": "last_name"}

Apply transformations to specific values in an object

transform.mapValues $data {"age": "toNumber", "name": "trim"}

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/transform";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  transform.omit $data ["password", "secret"]
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/transform
Version0.1.0
LicenseMIT
Unpacked Size7.2 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities