Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call replace on string instead of {string.js} object #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

spence
Copy link

@spence spence commented Apr 9, 2016

To reproduce:

test.js

// Invoke section of babel-polyfill code that resets Object.prototype
import 'babel-polyfill';
for (let _ of []) { _; }

import S from 'string';
S('Test').slugify().s;
$ nvm use v0.10.24
$ npm install babel-cli babel-preset-es2015 babel-polyfill string
$ node_modules/.bin/babel --presets es2015 test.js > test.es5.js
$ node test.es5.js

/git/test/node_modules/string/lib/string.js:134
      var s = this.replace(/[^A-Za-z0-9\[\] ]/g, function(x) { return latin_ma
                   ^
TypeError: Object Test has no method 'replace'
    at S.latinise (/git/test/node_modules/string/lib/string.js:134:20)
    at S.slugify (/git/test/node_modules/string/lib/string.js:413:37)
    at Object.<anonymous> (/git/test/test.es5.js:20:31)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

@jprichardson
Copy link
Owner

Please add a test and squash the package.json change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants