# replace 方法

接口 function replace(source: String, option: [] | {}): string;

版本 1.0.0

# 作用:可以根据指定的选项来替换内容

// 引入
import { replace } from 'project-libs';

// 单独引入
import replace from 'project-libs/build/data/replace';

# 参数

参数 类型 是否必须 含义
source string 需要替换的资源
option object 或 object[] 选项,可以为对象或者对象数组,{target: '<', replace: ''} 或者 [{target: '<', replace: ''}]

# 返回值

是否有返回值 类型 说明
string 返回字符串

# 小例子

const html = '<p>demo</p>';
const _html = replace(html, [{target: '<', replace: ''}, {target: '>', replace: ''}]);

// pdemop