Package Exports
- map-fns
- map-fns/index.esm.js
- map-fns/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (map-fns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
map-fns
Easily manipulate key-value stores in the browser and Node.js.
Why map-fns
?
- Zero dependencies: Keep your deployments and node modules lightweight.
- Modular: Import the functions you need, tree-shake the rest.
- Immutable & Pure: Function arguments are not modified and new objects are returned.
- TypeScript: Well documented and fully typed.
- Plain JavaScript objects: Keep things simple. No custom classes.
- Open Source: MIT licensed.
import { mergeInMap } from "map-fns";
const map = {
alice: {
name: "Alice",
permissions: ["view"],
},
bob: {
name: "Bob",
permissions: ["view", "merge", "push"],
},
};
const newMap = mergeInMap(map, ["alice"], {
permissions: (list) => [...list, "merge"],
});
console.log(newMap);
// > {
// alice: {
// name: "Alice",
// permissions: ["view", "merge"],
// },
// bob: {
// name: "Bob",
// permissions: ["view", "merge", "push"],
// },
// }
map-fns
supports tree-shaking. If your environment does not you can import a specific function directly.
import mergeInMap from "map-fns/mergeInMap";