How to use the tui-code-snippet.isString 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 parseCode2DataAndOptions(code, callback) {
  code = trimKeepingTabs(code);
  const [firstCode, secondCode] = code.split(/\n{2,}/);

  // try to parse first code block as `options`
  let options = parseCode2ChartOption(firstCode);
  const url = options && options.editorChart && options.editorChart.url;

  // if first code block is `options` and has `url` option, fetch data from url
  let dataAndOptions;
  if (util.isString(url)) {
    // url option provided
    // fetch data from url
    const success = dataCode => {
      dataAndOptions = _parseCode2DataAndOptions(dataCode, firstCode);
      callback(dataAndOptions);
    };
    const fail = () => callback(null);

    $.get(url).done(success).fail(fail);
  } else {
    // else first block is `data`
    dataAndOptions = _parseCode2DataAndOptions(firstCode, secondCode);
    callback(dataAndOptions);
  }
}
github nhn / tui.editor / src / js / extensions / chart / chart.js View on Github external
function parseCode2DataAndOptions(code, callback) {
  code = trimKeepingTabs(code);
  const [firstCode, secondCode] = code.split(/\n{2,}/);

  // try to parse first code block as `options`
  let options = parseCode2ChartOption(firstCode);
  const url = options && options.editorChart && options.editorChart.url;

  // if first code block is `options` and has `url` option, fetch data from url
  let dataAndOptions;
  if (util.isString(url)) {
    // url option provided
    // fetch data from url
    const success = dataCode => {
      dataAndOptions = _parseCode2DataAndOptions(dataCode, firstCode);
      callback(dataAndOptions);
    };
    const fail = () => callback(null);

    $.get(url).done(success).fail(fail);
  } else {
    // else first block is `data`
    dataAndOptions = _parseCode2DataAndOptions(firstCode, secondCode);
    callback(dataAndOptions);
  }
}
github nhn / tui.editor / src / js / extensions / mark / markerManager.js View on Github external
resetContent(content) {
    this.oldTextContent = (util.isString(content) ? content : null);
  }
github nhn / tui.editor / src / js / ui / toolbar.js View on Github external
indexOfItem(item) {
    let index;
    if (item instanceof ToolbarItem) {
      index = this._items.indexOf(item);
    } else if (util.isString(item)) {
      const itemName = item;
      index = this._items.map(itemToTest => itemToTest.getName()).indexOf(itemName);
    }

    return index;
  }
github nhn / tui.editor / src / js / domUtils.js View on Github external
const getParentUntil = function(node, untilNode) {
  let foundedNode;

  if (util.isString(untilNode)) {
    foundedNode = getParentUntilBy(node, targetNode => untilNode === getNodeName(targetNode));
  } else {
    foundedNode = getParentUntilBy(node, targetNode => untilNode === targetNode);
  }

  return foundedNode;
};
github nhn / tui.calendar / src / js / common / domutil.js View on Github external
find: function(selector, root, multiple) {
        var result = [],
            found = false,
            isFirst = util.isUndefined(multiple) || multiple === false,
            isFilter = util.isFunction(multiple);

        if (util.isString(root)) {
            root = domutil.get(root);
        }

        root = root || window.document.body;

        /**
         * Function for recursive find specific node
         * @param {HTMLElement} el - element to search
         * @param {string} selector - selector
         */
        function recurse(el, selector) {
            var childNodes = el.childNodes,
                i = 0,
                len = childNodes.length,
                cursor;
github nhn / tui.grid / src / js / model / data / columnModel.js View on Github external
hasTreeColumn: function() {
        return snippet.isString(this.get('treeColumnOptions').name);
    },
github nhn / tui.chart / src / js / components / series / pieChartSeries.js View on Github external
_isDetectedLabel(position) {
        const labelElement = document.elementFromPoint(position.left, position.top);

        return snippet.isString(labelElement.className);
    }