How to use the tui-code-snippet.isExisty function in tui-code-snippet

To help you get started, weโ€™ve selected a few tui-code-snippet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhn / tui.editor / src / js / extensions / table / mergedTableAddCol.js View on Github external
function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
  const cellData = rowData[colIndex];
  let newCell;

  if (util.isExisty(cellData.colMergeWith)) {
    const {colMergeWith} = cellData;
    const merger = rowData[colMergeWith];
    const lastMergedCellIndex = colMergeWith + merger.colspan - 1;

    if (util.isExisty(merger.rowMergeWith) && prevCell) {
      newCell = util.extend({}, prevCell);
    } else if (lastMergedCellIndex > colIndex) {
      merger.colspan += 1;
      newCell = util.extend({}, cellData);
    }
  } else if (cellData.colspan > 1) {
    cellData.colspan += 1;
    newCell = _createColMergedCell(colIndex, cellData.nodeName);
  }

  if (!newCell) {
    newCell = dataHandler.createBasicCell(rowIndex, colIndex + 1, cellData.nodeName);
  }

  return newCell;
}
github nhn / tui.chart / src / js / models / data / dataProcessor.js View on Github external
getCategories(isVertical) {
        const type = isVertical ? 'y' : 'x';
        let foundCategories = [];

        if (!this.categoriesMap) {
            this.categoriesMap = this._processCategories(type);
        }

        if (snippet.isExisty(isVertical)) {
            foundCategories = this.categoriesMap[type] || [];
        } else {
            Object.values(this.categoriesMap).every(categories => {
                foundCategories = categories;

                return false;
            });
        }

        return foundCategories;
    }
github nhn / tui.chart / src / js / models / data / seriesItemForCoordinateType.js View on Github external
addRatio(valueType, divNumber, subNumber) {
        if (!snippet.isExisty(this.ratioMap[valueType]) && divNumber) {
            this.ratioMap[valueType] = (this[valueType] - subNumber) / divNumber;
        }
    }
github nhn / tui.chart / src / js / components / series / barTypeSeriesBase.js View on Github external
seriesGroup.map(({start, startLabel, endLabel}) => {
                const label = {
                    end: this.decorateLabel(endLabel)
                };

                if (snippet.isExisty(start)) {
                    label.start = this.decorateLabel(startLabel);
                }

                return label;
            })
        ));
github nhn / tui.virtual-keyboard / src / js / virtualKeyboard.js View on Github external
_getTemplate: function(keyGroup, key) {
        var template;

        if (keyGroup === 'blank') {
            template = this._template.blank;
        } else {
            template = this._template[key] || this._template.key;
        }

        if (snippet.isExisty(key)) {
            template = template.replace(/{KEY}/g, key);
        }

        return template;
    },
github nhn / tui.editor / src / js / extensions / table / mergedTableRemoveCol.js View on Github external
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
      const cellData = rowData [colIndex];

      if (util.isExisty(cellData.colMergeWith)) {
        const merger = rowData [cellData.colMergeWith];

        if (merger.colspan) {
          merger.colspan -= 1;
        }
      } else if (cellData.colspan > 1) {
        const lastMergedCellIndex = colIndex + cellData.colspan - 1;

        cellData.colspan -= (endColIndex - colIndex + 1);

        if (lastMergedCellIndex > endColIndex) {
          rowData [endColIndex + 1] = util.extend({}, cellData);
        }
      }
    });
  });
github nhn / tui.chart / src / js / components / series / pieChartSeries.js View on Github external
onClickSeries(position) {
        const sectorInfo = this._executeGraphRenderer(position, 'findSectorInfo');
        const prevIndex = this.prevClickedIndex;
        const {allowSelect} = this.options;

        if ((sectorInfo || this._isDetectedLabel(position)) && snippet.isExisty(prevIndex) && allowSelect) {
            this.onUnselectSeries({
                indexes: {
                    index: prevIndex
                }
            });
            this.prevClickedIndex = null;
        }

        if (!sectorInfo || sectorInfo.chartType !== this.seriesType) {
            return;
        }

        const foundIndex = sectorInfo.index;
        const shouldSelect = foundIndex > -1 && (foundIndex !== prevIndex);

        if (allowSelect && !shouldSelect) {
github nhn / tui.chart / src / js / helpers / dataExporter.js View on Github external
function _get2DArrayFromRawData(rawData) {
    const resultArray = [];
    const isHeatMap = (rawData.categories && snippet.isExisty(rawData.categories.x));
    const isBullet = (rawData.series && snippet.isExisty(rawData.series.bullet));
    let return2DArrayData = false;

    if (rawData) {
        let categories;

        if (isHeatMap) {
            return2DArrayData = _get2DArrayFromHeatmapRawData(rawData);
        } else if (isBullet) {
            return2DArrayData = _get2DArrayFromBulletRawData(rawData);
        } else if (rawData.categories) {
            ({categories} = rawData);
        }
        if (return2DArrayData) {
            return return2DArrayData;
        }
github nhn / tui.chart / src / js / models / data / dataProcessor.js View on Github external
isLineCoordinateType() {
        let {lineCoordinateType} = this;

        if (!snippet.isExisty(lineCoordinateType)) {
            const {chartType} = this;
            lineCoordinateType = predicate.isLineTypeChart(chartType) && !this.hasCategories();
            this.lineCoordinateType = lineCoordinateType;
        }

        return lineCoordinateType;
    }