stephenlacy / bump-regex

bump regex with semver
MIT License
13 stars 10 forks source link

README.md example does not work #5

Closed nfantone closed 8 years ago

nfantone commented 8 years ago

The example shown on the docs does not work on latest master.

Executing this:

var bump = require('bump-regex');

bump('version: "0.1.2"', function(err, out) {
  // => 'version: "0.1.3"'
});

will end up with:

~/bump-regex/index.js:8
  opts.key = opts.key || 'version';
           ^

TypeError: Cannot assign to read only property 'key' of version: "0.1.2"
    at module.exports (/Users/nfantone/Development/js/bump-regex/index.js:8:12)
    at Object.<anonymous> (/Users/nfantone/Development/js/bump-regex/test.js:4:1)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:148:18)
    at node.js:405:3

I believe options should be changed to: { str: JSON.stringify({ version: '0.1.2' }) }.