web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
419 B

  1. "use strict";
  2. var value = require("../../object/valid-value");
  3. module.exports = function (search, replace) {
  4. var index, pos = 0, str = String(value(this)), sl, rl;
  5. search = String(search);
  6. replace = String(replace);
  7. sl = search.length;
  8. rl = replace.length;
  9. while ((index = str.indexOf(search, pos)) !== -1) {
  10. str = str.slice(0, index) + replace + str.slice(index + sl);
  11. pos = index + rl;
  12. }
  13. return str;
  14. };