0.1.0 • Published 10 months ago

auto-todo v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Auto-Todo

Ever wanna not write code? Auto-Todo is your friend. Instead of writing logic, you get to lay back and write tests!

  • ✅ Test-driven development
  • ✅ 100% test coverage
  • ✅ No-code development
import * as assert from "assert"
import { todo } from "auto-todo"

const add = todo<(a: number, b: number) => number>(
    add => {
        assert.equal(add(1, 2), 3)
        assert.equal(add(2, 3), 5)
    },
    { args: 2 },
)

add(1, 2) // 3
add(2, 3) // 5
add(5, 8) // 13, hopefully

(b * 2) - 1!

  • 2 * 2 - 1 = 3
  • 3 * 2 - 1 = 5
  • 8 * 2 - 1 = 15

In the scope of auto-todo, letting this happen is considered a user error. Write your tests well!

Installation

pnpm install auto-todo
yarn add auto-todo
npm install auto-todo

Notes

  • Uses eval to generate code
  • It takes a little time to generate the code! Or a big time!
    • Math.random() is used generously
    • The complexity of the requested function plays a role. a + b will generate faster than a * 5 + b * 2 - 4
0.1.0

10 months ago