How to use the tui-code-snippet.isUndefined 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 / bower_components / tui-editor / src / js / extensions / chart / chart.js View on Github external
function setDefaultOptions(options, chartContainer) {
  options = util.extend({
    editorChart: {},
    chart: {},
    chartExportMenu: {}
  }, options);

  let {width, height} = options.chart;
  const isWidthUndefined = util.isUndefined(width);
  const isHeightUndefined = util.isUndefined(height);
  if (isWidthUndefined || isHeightUndefined) {
    // if no width or height specified, set width and height to container width
    const {
      width: containerWidth
    } = chartContainer.getBoundingClientRect();
    options.chart.width = isWidthUndefined ? containerWidth : width;
    options.chart.height = isHeightUndefined ? containerWidth : height;
  }

  options.editorChart.type = options.editorChart.type ? `${options.editorChart.type}Chart` : 'columnChart';
  options.chartExportMenu.visible = options.chartExportMenu.visible || false;

  return options;
}
github nhn / tui.editor / bower_components / tui-editor / src / js / extensions / chart / chart.js View on Github external
function parseCode2ChartOption(optionCode) {
  const reservedKeys = ['type', 'url'];
  let options = {};
  if (util.isUndefined(optionCode)) {
    return options;
  }

  const optionLines = optionCode.split(REGEX_LINE_ENDING);
  optionLines.forEach(line => {
    let [keyString, ...values] = line.split(OPTION_DELIMITER);
    let value = values.join(OPTION_DELIMITER);
    keyString = keyString.trim();
    if (value.length === 0) {
      return;
    }

    try {
      value = JSON.parse(value.trim());
    } catch (e) {
      value = value.trim();
github nhn / tui.editor / src / js / extensions / chart / chart.js View on Github external
function parseCode2ChartOption(optionCode) {
  const reservedKeys = ['type', 'url'];
  let options = {};
  if (util.isUndefined(optionCode)) {
    return options;
  }

  const optionLines = optionCode.split(REGEX_LINE_ENDING);
  optionLines.forEach(line => {
    let [keyString, ...values] = line.split(OPTION_DELIMITER);
    let value = values.join(OPTION_DELIMITER);
    keyString = keyString.trim();
    if (value.length === 0) {
      return;
    }

    try {
      value = JSON.parse(value.trim());
    } catch (e) {
      value = value.trim();
github nhn / tui.editor / src / js / extensions / mark / markdownMarkerHelper.js View on Github external
result.push({
          line: lineIndex,
          ch: offsetlist[offsetIndex] - beforeLength
        });

        offsetIndex += 1;

        if (util.isUndefined(offsetlist[offsetIndex])) {
          return result;
        }
      }

      beforeLength = currentLength;
    }

    while (!util.isUndefined(offsetlist[offsetIndex])) {
      result.push({
        line: lineIndex,
        ch: currentLength - beforeLength
      });

      offsetIndex += 1;
    }

    return result;
  }
github nhn / tui.chart / src / js / components / series / pieChartSeries.js View on Github external
_makeValidAngle(angle, defaultAngle) {
        if (snippet.isUndefined(angle)) {
            angle = defaultAngle;
        } else if (angle < 0) {
            angle = ANGLE_360 - (Math.abs(angle) % ANGLE_360);
        } else if (angle > 0) {
            angle = angle % ANGLE_360;
        }

        return angle;
    }
github nhn / tui.chart / src / js / components / mouseEventDetectors / mouseEventDetectorBase.js View on Github external
_calculateLayerPosition(clientX, clientY, checkLimit) {
        const {left, right, top} = this.mouseEventDetectorContainer.getBoundingClientRect();
        const seriesPosition = this.positionMap.series;
        const {expandSize} = this;
        const layerPosition = {};

        checkLimit = snippet.isUndefined(checkLimit) ? true : checkLimit;

        if (checkLimit) {
            const maxLeft = right - expandSize;
            const minLeft = left + expandSize;
            clientX = Math.min(Math.max(clientX, minLeft), maxLeft);
        }

        layerPosition.x = clientX - left + seriesPosition.left - chartConst.CHART_PADDING;

        if (!snippet.isUndefined(clientY)) {
            layerPosition.y = clientY - top + seriesPosition.top - chartConst.CHART_PADDING;
        }

        return layerPosition;
    }
github nhn / tui.chart / src / js / components / series / mapChartSeries.js View on Github external
_showWedge(index) {
        const {ratio, label} = this.mapModel.getDatum(index);

        if (!snippet.isUndefined(ratio)) {
            this.eventBus.fire('showWedge', ratio, label);
        }
    }
github nhn / tui.chart / src / js / components / series / pieChartSeries.js View on Github external
_makeValidAngle(angle, defaultAngle) {
        if (snippet.isUndefined(angle)) {
            angle = defaultAngle;
        } else if (angle < 0) {
            angle = ANGLE_360 - (Math.abs(angle) % ANGLE_360);
        } else if (angle > 0) {
            angle = angle % ANGLE_360;
        }

        return angle;
    }
github nhn / tui.chart / src / js / components / plots / plot.js View on Github external
* @type {string}
         */
        this.className = 'tui-chart-plot-area';

        /**
         * Data processor
         * @type {DataProcessor}
         */
        this.dataProcessor = params.dataProcessor;

        /**
         * Options
         * @type {object}
         */
        this.options = params.options || {};
        this.options.showLine = snippet.isUndefined(this.options.showLine) ? true : this.options.showLine;
        this.options.lines = this.options.lines || [];
        this.options.bands = this.options.bands || [];

        /**
         * x axis type option
         * @type {?string}
         */
        this.xAxisTypeOption = params.xAxisTypeOption;

        /**
         * Theme
         * @type {object}
         */
        this.theme = params.theme || {};

        /**