Skip to content
This repository was archived by the owner on Sep 7, 2026. It is now read-only.

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

Open
spence wants to merge 2 commits into
jprichardson:masterfrom
spence:master
Open

spence wants to merge 2 commits into
jprichardson:masterfrom
spence:master

Conversation

@spence

@spence spence commented Apr 9, 2016

Copy link
Copy Markdown

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
Copy Markdown
Owner

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants