Test construction of paths

Benchmark created on


Setup

const funcPath = "p.names[0].comments[10].value";
const newPath = "p.names.0.comments.10.value";

const stringToPathNew = stringPath => (
    root => (
        stringPath.split(".").reduce((result, part) => result[part], root)
    )
);

Test runner

Ready to run.

Testing in
TestOps/sec
new Function
const path = new Function("p", funcPath);
ready
stringToPathNew
const path = stringToPathNew(newPath);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.