react-json-fp
v1.0.1
Published
React-JSON-FP is a React component library that uses JSON and functional programming methods to declare how data is displayed. Code-as-data / homoiconicity reduces complexity, making apps more easily testable and distributable.
Downloads
8
Maintainers
Readme
deep-ply
A simple javascript library for applying a function deeply.
Installation
npm install deep-ply
Usage
import deepPly from "deep-ply"
const data = {
id: "1",
value: "foo",
items: [
{ id: "1.1", value: "bar", items: [{ id: "1.1.1", value: "qux" }] },
{ id: "1.2", value: "quux" },
],
}
const callback = (value, path) => {
if (path === "/items/0/value") return value.toUpperCase()
return value
}
deepPly(callback)(data)
// {
// id: "1",
// value: "foo",
// items: [
// { id: "1.1", value: "BAR", items: [{ id: "1.1.1", value: "qux" }] },
// { id: "1.2", value: "quux" },
// ],
// }