mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 22:22:58 +00:00

PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
11 lines
316 B
JavaScript
11 lines
316 B
JavaScript
'use strict';
|
|
|
|
var indexOf = String.prototype.indexOf, slice = String.prototype.slice;
|
|
|
|
module.exports = function (search, replace) {
|
|
var index = indexOf.call(this, search);
|
|
if (index === -1) return String(this);
|
|
return slice.call(this, 0, index) + replace +
|
|
slice.call(this, index + String(search).length);
|
|
};
|