当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.replace函数代码示例

本文整理汇总了TypeScript中lodash.replace函数的典型用法代码示例。如果您正苦于以下问题:TypeScript replace函数的具体用法?TypeScript replace怎么用?TypeScript replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了replace函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: RegExp

  $onChanges() {
    const initialValue = this.page && this.page.content ? this.page.content : "";
    let ast = remark.parse(initialValue);

    let content = "";
    let sectionOpen = false;
    this.three_columns = true;


    var sectionValue = "";
    for (let c = 0; c < ast.children.length; c++) {
      const child = ast.children[c];

      if (child.type !== 'heading' || child.depth < 2 || child.depth > 2) {
        continue;
      }

      if (sectionOpen) {
        sectionValue += "</section>";
      }

      let id = child.children[0].value.replace(new RegExp(' ', 'g'), '').toLowerCase();
      sectionValue += "<section id='" + id + "'>";
      sectionOpen = true;

      ast.children.splice(c, 0, {
        type: 'html',
        value: sectionValue
      });
      c++;
      sectionValue = "";
    }

    if (sectionOpen) {
      ast.children.splice(ast.children.length - 1, 0, {
        type: 'html',
        value: sectionValue
      });
    }

    content = remark.stringify(ast);

    new Viewer(Object.assign({
      el: document.querySelector("#viewerSection"),
      viewer: true,
      height: "auto",
      initialValue: _.replace(
                      _.replace(content,
                        '(#', '(' + this.$location.absUrl() + '#'),
                      'href="#', 'href="'+ this.$location.absUrl() + '#'
      ),
      useDefaultHTMLSanitizer: false
    }, this.options));
  }
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:54,代码来源:page-editormarkdown-viewer.component.ts

示例2: Transaction

 res.transactionDOList.forEach((trans: any) => {
   let txn = new Transaction();
    txn.id = trans.transactionId;
    txn.requestor = trans.requestor;
    txn.submissionDate = _.replace(trans.transactionDate, "at", cst.EMPTY_STR);
    txn.type = _.replace(trans.transactionType, "VUE", "VUM");
    txn.serviceAddress=CommonUtil.isNotBlank(trans.streetAddress)?trans.streetAddress:cst.NA;
    txn.unit = CommonUtil.isNotBlank(trans.unit)?trans.unit:cst.NA;
  if(!((trans.transactionType).includes("Email")) && !((trans.transactionType).includes("Update User")))
     txnList.push(txn);
 });
开发者ID:bbachi,项目名称:Angular5Sample,代码行数:11,代码来源:transactions.helper.ts

示例3: RegExp

 processedParams.forEach(param => {
   stringToReplace = _.replace(
     stringToReplace,
     new RegExp('{{' + param.key + '}}', 'g'),
     param.value
   );
   stringToReplace = _.replace(
     stringToReplace,
     new RegExp('{{ ' + param.key + ' }}', 'g'),
     param.value
   );
 });
开发者ID:cmgustavo,项目名称:copay,代码行数:12,代码来源:replace-parameters.ts

示例4:

export const translateAddress = (address='') => {
  let temp =  _.replace(address, 'A', 'ถนน');
  temp =  _.replace(temp, 'S', 'ซอย');
  temp =  _.replace(temp, 'T', 'ตรอก');
  temp =  _.replace(temp, 'N', 'เลขที่');
  temp =  _.replace(temp, 'B', 'อาคาร');
  temp =  _.replace(temp, 'V', 'หมู่บ้าน');
  temp =  _.replace(temp, 'H', 'บ้าน');
  temp =  _.replace(temp, 'M', 'หมู่ที่');
  temp =  _.replace(temp, 'R', 'ห้อง');
  temp =  _.replace(temp, 'F', 'ชั้น');

  return temp;
}
开发者ID:warozz,项目名称:D3VMobiz,代码行数:14,代码来源:address-util.ts

示例5: setMedia

 /**
  * เซต PDF เข้ามีเดีย
  */
 public setMedia(data)
 {
   let arr = [];
   const key = _.replace(data.documentname, '.pdf', '');
   arr[key] = data;
   this.medias = arr;
 }
开发者ID:warozz,项目名称:D3VMobiz,代码行数:10,代码来源:sale-media-data.ts

示例6:

 return _.filter(templates, (template) => {
     if (_.startsWith((template as any).name, collection.collection)) {
         (template as any).label = _.replace((template as any).name, collection.collection + '/', '');
         return template;
     }
     return false;
 });
开发者ID:mactanxin,项目名称:gui,代码行数:7,代码来源:docker-collection-repository.ts

示例7: require

const resolveWebpackConfig = (configFile: string): Configuration => {
  const finalConfigFile = _.replace(configFile, /\$\{?PWD\}?/g, process.env.PWD);

  if (_.startsWith(finalConfigFile, "/")) {
    return require(finalConfigFile);
  }

  return require(path.join(process.cwd(), configFile));
};
开发者ID:morlay,项目名称:babel-plugin-webpack-loaders-inline-exports,代码行数:9,代码来源:index.ts

示例8: function

    fs.readdir(complete_transform_dir, function (err, query_files) {
        if (err) throw err;
        for (var i in query_files) {

            if (_.endsWith(query_files[i], cons.ENDING_KIDSLE_KB)) {

                /* product means information-type like playgrounds, schools, doctors or daycare */
                var product: string = _.replace(query_files[i], cons.ENDING_KIDSLE_KB, '');

                var full_path_kidsle_kb_file: string = complete_transform_dir + pathSep() + query_files[i];
                var full_path_overpass_file: string = complete_transform_dir + pathSep() + _.replace(query_files[i], cons.ENDING_KIDSLE_KB, cons.ENDING_OP_CLEAN);

                var content_kidsle_kb_file: string = fs.readFileSync(full_path_kidsle_kb_file).toString();
                var content_overpass_file: string = fs.readFileSync(full_path_overpass_file).toString();

                var json_content_kidsle_kb_file: string = JSON.parse(content_kidsle_kb_file)['features'];
                var json_content_overpass_file: string = JSON.parse(content_overpass_file)['features'];

                let return_Array: any[] = [];

                _(json_content_overpass_file).forEach(function (value_overpass) {
                    var op_lon: string = value_overpass['geometry']['coordinates'][0];
                    var op_lat: string = value_overpass['geometry']['coordinates'][1];
                    var kidsle_properties = new Array();

                    _(json_content_kidsle_kb_file).forEach(function (value_kidsle) {
                        var kidsle_lon: string = value_kidsle['geometry']['coordinates'][0];
                        var kidsle_lat: string = value_kidsle['geometry']['coordinates'][1];

                        // if op-latlon == kidsle-latnon
                        if (op_lat == kidsle_lat && op_lon == kidsle_lon) {
                            kidsle_properties = value_kidsle['properties'];
                        }
                    });

                    /* assign overpass-tags with kidsle-tags  */
                    return_Array.push({
                        id: value_overpass['id'],
                        longitude: value_overpass['geometry']['coordinates'][0],
                        latitude: value_overpass['geometry']['coordinates'][1],
                        tags: _.assign(value_overpass['properties']['tags'], kidsle_properties)
                    });
                });

                let return_array_geojson: any = geojson.parse(return_Array, { Point: ['latitude', 'longitude'] });
                let target_fileName: string = complete_transform_dir + pathSep() + product + cons.ENDING_OP_CLEAN_MERGE_KIDSLE;

                delete_file(target_fileName);
                
                write_file(target_fileName, return_array_geojson);
            }
        }
    });
开发者ID:CodeforLeipzig,项目名称:osm4kids,代码行数:53,代码来源:transform.ts

示例9: getRawPhoneNumberFromFormatedPhone

public static getRawPhoneNumberFromFormatedPhone(formatedPhone:string):string {
	var phoneNumber ="";
	if (null != formatedPhone && CommonUtil.isNotBlank(formatedPhone)) {
		phoneNumber = formatedPhone.replace("(", "");
		phoneNumber = phoneNumber.replace(")", "");
		phoneNumber = phoneNumber.replace(" ", "");
//		phoneNumber = phoneNumber.replaceAll("-", EMPTY);
		phoneNumber = replace(phoneNumber, "-", "");
	}

	return phoneNumber;
}
开发者ID:bbachi,项目名称:Angular5Sample,代码行数:12,代码来源:common.util.ts

示例10: if

 _.forEach(address, (value) => {
   const check = _.filter(pattern, (patternValue) => _.startsWith(value, patternValue))
   if (isNo && predictStartWithNum.test(value)) {
     text += ' ' + value;
     isNo = false;
     checkSum--;
   } else if (isNo) {
     isNo = false;
   }
   if (!_.isEmpty(check)) {
     text = _.trim(_.replace(value, check, ''));
     isNo = true;
     checkSum--;
   }
 });
开发者ID:warozz,项目名称:D3VMobiz,代码行数:15,代码来源:address-util.ts


注:本文中的lodash.replace函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。