mutor
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Mutor

A simple typed-checked utility for mutating object.

import {Mutor} from 'mutor';
type Clock = {
  min: number
  hr: number
}
const m = Mutor<Clock>(['min', 'hr']);
const now:Clock = {min: 10, hr: 5};

// => {min: 20, hr: 5}
m.min(20)(now) 

// => {min: 15, hr: 5}
m.min(s => s + 5)(now) 

// => {min: 30, hr: 10}
m.merge({min: 30, hr: 10})(now);

Package Sidebar

Install

npm i mutor

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • sliv