• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.join函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

    _.each(this.data.columns, (data) => {

      // x축 데이터 categoryName에 설정
      const nameList: string[] = _.split(data.name, CHART_STRING_DELIMITER);

      let categoryList = [];
      let seriesList = [];

      // 열에만 dimension1개가 존재하는경우
      if (0 == nameList.indexOf(this.pivot.aggregations[0].alias)) {
        seriesList = nameList.splice(1, this.pivot.rows.length);
      } else {
        // columns 개수만큼 리스트 잘라서 설정
        categoryList = nameList.splice(0, this.pivot.columns.length);
        // rows 개수만큼 리스트 잘라서 설정
        seriesList = nameList.splice(0, this.pivot.rows.length);
      }

      data.categoryName = _.cloneDeep(_.join(_.slice(categoryList, 0, this.pivot.columns.length), CHART_STRING_DELIMITER));

      data.seriesName = _.cloneDeep(_.join(_.slice(seriesList, 0, this.pivot.rows.length), CHART_STRING_DELIMITER));

      // 해당 dataIndex로 설정
      data.seriesValue = _.cloneDeep(data.value[2]);
    });
开发者ID:bchin22,项目名称:metatron-discovery,代码行数:25,代码来源:heatmap-chart.component.ts


示例2: convertXAxisRotateName

  /**
   * x축 가로/세로에 따라 축명 위치변경
   * @param chartOption
   * @param uiOption
   * @param axisType
   */
  public static convertXAxisRotateName(chartOption: BaseOption, uiOption: UIOption, fieldInfo: PivotTableInfo): BaseOption {

    // type이 없는경우 return
    if (!uiOption || _.isUndefined(uiOption['align'])) return chartOption;

    const axisList = _.compact(_.concat(uiOption.xAxis, uiOption.yAxis, uiOption.subAxis));
    const type = uiOption['align'];

    const yAxis = axisList.filter((item) => {
      return _.eq(item.mode, AxisLabelType.COLUMN) || _.eq(item.mode, AxisLabelType.SUBCOLUMN);
    });

    // 앞에서 category / value위치를 변경하였으므로 변경된 type에 따라서 위치변경
    let copiedOption = _.cloneDeep(chartOption);

    let yAxisType: AxisType;

    // default일때(세로모드, x축 category, y축 value)에는 변경하지않음
    if (_.eq(type, UIOrient.VERTICAL) && copiedOption.yAxis[0].type == AxisType.VALUE && copiedOption.xAxis[0].type == AxisType.CATEGORY) return chartOption;

    // 세로모드일때
    if (_.eq(type, UIOrient.VERTICAL)) {

      // y축이 value이면 => y축 값을 x축으로 넣기
      yAxisType = AxisType.VALUE;

    // 가로모드일때
    } else {
      // y축이 category이면 => y축 값을 x축으로 넣기
      yAxisType = AxisType.CATEGORY;
    }

    // Y축 명칭
    const yName = uiOption.yAxis.customName ? uiOption.yAxis.customName : _.join(fieldInfo.aggs, CHART_STRING_DELIMITER);
    const yAxisName = _.join(fieldInfo.aggs, CHART_STRING_DELIMITER);

    // y축이 yAxisType이면 => y축 값을 x축으로 넣기
    copiedOption.yAxis.forEach((axis, axisIndex) => {
      chartOption.xAxis.forEach((item, index) => {

        if (axis.type == yAxisType && copiedOption.yAxis[index].axisName) {
          item.axisName = yAxisName;

          // customName이 없을때
          if (!yAxis[axisIndex].customName && copiedOption.yAxis[index].name) {
            item.name = yName;
          }
        }
      });
    })

    return chartOption;
  }
开发者ID:bchin22,项目名称:metatron-discovery,代码行数:59,代码来源:common-option-converter.ts


示例3: main

async function main() {
    const writer = createObjectCsvWriter({
        path: "puutteelliset.csv",
        header: [
            { id: "perusteId", title: "Peruste id" },
            { id: "nimi", title: "Nimi" },
            { id: "puuttuvat", title: "Puuttuvat osaamisalakuvaukset" },
        ]
    });

    const iter = lib.iteratePerusteet();
    const brokenOsaamisalat = [];

    for await (const peruste of iter) {
        if (!_.isEmpty(peruste.osaamisalat)) {
            const kuvaukset = await lib.getOsaamisalakuvaukset(peruste.id);
            const puuttuvat = _(peruste.osaamisalat)
                .filter(oa => !kuvaukset[oa.uri])
                .map("arvo")
                .value();

            if (!_.isEmpty(puuttuvat)) {
                brokenOsaamisalat.push({
                    perusteId: peruste.id,
                    nimi: peruste.nimi.fi,
                    puuttuvat: _.join(puuttuvat, " ")
                });
                console.log(_.last(brokenOsaamisalat));
            }
        }
    }

    await writer.writeRecords(brokenOsaamisalat);
}
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:34,代码来源:puutteellisetosaamisalat.ts


示例4: IN

    static async delete<T extends Model>(ids: (string | UUID)[]): Promise<boolean> {
        if (!ids || ids.length < 0) throw `id 不能为 '${ids}'`;
        if (!this['_id']) throw `数据模型 ${this.name} 缺少 @id 字段`;

        ids = _.map(ids, id => id.toString());

        let promises = _.map(this['_joins'], join => {
            let sql = `
                    DELETE FROM ${join['tableName']}
                    WHERE       ${join['joinColumn']} IN (
                        SELECT  ${join['referencedColumn']}
                        FROM    ${this['_tableName']}
                        WHERE   ${this['_id']} IN (${_.join(_.map(ids, id => `'${id.toString()}'`))})
                    )`;

            return this['_conn'].execute(sql);
        });

        try {
            await Promise.all<IResult>(promises);
            await this['_conn'].execute(`
                DELETE FROM ${this['_tableName']}
                WHERE   ${this['_id']} IN (${_.join(_.map(ids, id => `'${id.toString()}'`))})`);
        } catch (error) {
            console.error(error);
            await this['_conn'].release();

            return false;
        }

        return true;
    }
开发者ID:wangxin0709,项目名称:csc-scms-node-koa,代码行数:32,代码来源:model.ts


示例5: convertYAxisData

  /**
   * heatmap 차트별 Y축 정보
   * - 필요시 각 차트에서 Override
   * @returns {BaseOption}
   */
  protected convertYAxisData(): BaseOption {

    ////////////////////////////////////////////////////////
    // 차트 데이터를 기반으로 Y축 생성
    ////////////////////////////////////////////////////////

    // Y축 명칭
    let yAxisName = this.uiOption.yAxis.customName ? this.uiOption.yAxis.customName : _.join(this.fieldInfo.rows, CHART_STRING_DELIMITER);
    this.chartOption.yAxis[0].name = yAxisName;
    this.chartOption.yAxis[0].axisName = _.join(this.fieldInfo.rows, CHART_STRING_DELIMITER);

    ////////////////////////////////////////////////////////
    // 차트 데이터를 기반으로 Y축 데이터 생성
    ////////////////////////////////////////////////////////

    // Y축 데이터
    this.data.columns.map((column) => {
      const nameList: string[] = _.split(column.name, CHART_STRING_DELIMITER);

      let sliceList = [];
      // 열에만 dimension1개가 존재하는경우
      if (0 == nameList.indexOf(this.pivot.aggregations[0].alias)) {
        sliceList = _.slice(nameList, 1, this.fieldInfo.rows.length + 1);
      } else {
        sliceList = _.slice(nameList, this.fieldInfo.cols.length);
      }

      this.chartOption.yAxis[0].data.push(_.join(sliceList, CHART_STRING_DELIMITER));
    });
    this.chartOption.yAxis[0].data = _.uniq(this.chartOption.yAxis[0].data);

    // 차트옵션 반환
    return this.chartOption;
  }
开发者ID:bchin22,项目名称:metatron-discovery,代码行数:39,代码来源:heatmap-chart.component.ts


示例6: buildThreadParticipantsList

export function buildThreadParticipantsList(state:ApplicationState, thread:Thread):string {

  const names = _.keys(thread.participants).map(
    participantId => state.storeData.participants[participantId].name);

  return _.join(names, ",");
}
开发者ID:MidoShahin,项目名称:Chat-App-using-ngrx-store,代码行数:7,代码来源:buildThreadParticipantsList.ts


示例7: getWeaponBonus

 getWeaponBonus(weapon: Weapon) {
   let result = [];
   _.forEach(this.data.getAtkBonus()['melee'], (bonus) => {
     result.push(bonus*1 + weapon.bonus*1);
   });
   
   return _.join(result, '/');
 }
开发者ID:Vargash,项目名称:DMVTools,代码行数:8,代码来源:weapons.ts


示例8: component

function component() {
  var element = document.createElement('div');

  // Lodash, directly imported by this script.
  element.innerHTML = _.join(['Hello', 'typescript', 'webpack'], ' ');

  return element;
}
开发者ID:nedbert,项目名称:home-projects,代码行数:8,代码来源:index.ts


示例9: save

    /**
     * 保存 entity 实体
     */
    async save(): Promise<this> {
        if (!this.constructor['_id']) throw `数据模型 ${this.constructor.name} 缺少 @id 字段`;
        let columns = this.constructor['_columns'];
        let idColumn = _.find(columns, { primaryKey: true }),
            id = _.get<{}, string>(idColumn, 'name'),
            idColumnName = _.get<{}, string>(idColumn, 'columnName'),
            _this: any = this;
        this[id] = this[id] || UUID.create();

        try {
            let isExist = await this.constructor['isExist'](this[id]),
                sql: string,
                obj: {};

            if (!isExist) {
                // 插入操作
                sql = `
                    INSERT INTO ${this.constructor['_tableName']}
                           (${_.join(_.map(columns, 'columnName'))})
                    VALUES (${_.join(_.map(columns, column => `:${column['name']}`))})`;

            } else {
                // 更新操作
                sql = `
                    UPDATE ${this.constructor['_tableName']}
                    SET    ${_.join(_.map(columns, column => `${column['columnName']}=:${column['name']}`))}
                    WHERE  ${idColumnName}=:${id}`;
            }
            let value: any;
            obj = _.reduce<IColumnMeta, any>(columns, (result, column) => {
                value = _.get(this, column.name);

                value = value && value.constructor.name === 'UUID' ? value.toString() :
                    value && value.constructor.name === 'Moment' ? value.toDate() :
                        value;

                return _.set(result, column.name, value);
            }, {});
            await this.constructor['_conn'].execute(sql, obj);
        } catch (error) {
            console.error(error);
            this.constructor['_conn'].release();
            throw error;
        }
        return this;
    }
开发者ID:wangxin0709,项目名称:csc-scms-node-koa,代码行数:49,代码来源:model.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.kebabCase函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.isUndefined函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap