OS: Win 7 Pro 64bit
Node: v7.7.1
SVGO: @0.7.2
The Node module example listed at https://github.com/svg/svgo/blob/master/examples/test.js#L15 does not work as documented:
svgo
.optimize(svgstr)
.then(function(res) { ... })
;
The above snippet throws an error message: TypeError: callback is not a function.
This is because the .optimize method specifies an svgstr arg, and a callback arg, and does not return a Promise for .then to be used.
The working snippet should be:
svgo
.optimize(content, function(res) {
console.log(res);
})
;
I suspect this is an oversight in the API design implementation, which I would expect is true as the promise based approach documented in the examples seems like a logical feature.
..likely because examples refers to a unreleased version. Also, #750.
Fair enough, though I would expect master to be the current stable release available on NPM. Unreleased features seem like a dev branch workflow to me.
I'm not the maintainer, but linking to a file in the "master" branch shouldn't encourage you to make the assumption that latest release is on par. With that said I would love to see more regular releases!
You should never release an unstable version to master.
Most helpful comment
You should never release an unstable version to master.