client.replace
Replace substring (first occurrence or all)
browsernot registered- Package
- @procedures/client · README
- Path
["client","replace"]- CLI
- Not a
markcommand: it is not in the default registry. - As data
{"$proc":["client","replace"],"input":{}}- Tags
- core, string
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";
for (const procedure of allCoreProcedures) {
if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","replace"], { value: "<value>", search: "<search>", replace: "<replace>" });
console.log(JSON.stringify(result));As data, in a program
{
"$proc": ["client", "replace"],
"input": {
"value": "<value>",
"search": "<search>",
"replace": "<replace>"
}
}Input
| Field | Type | Required |
|---|---|---|
value | string | yes |
search | string | yes |
replace | string | yes |
all | boolean | no |
Output
The schema does not list fields (string).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "The value"
},
"search": {
"type": "string",
"description": "The text to find"
},
"replace": {
"type": "string",
"description": "The replacement text"
},
"all": {
"description": "Replace every match, not only the first one",
"type": "boolean"
}
},
"required": [
"value",
"search",
"replace"
]
},
"output": {
"type": "string",
"description": "The string with the replacements"
}
}