Use `wrap-fn`

Support synchronous errors, promises and adds updated tests. Also adds a test script to support the common `npm test` command.