How to use the tui-code-snippet.isArray 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.chart / src / js / charts / chartBase.js View on Github external
_initializeRawData(rawData) {
        const data = objectUtil.deepCopy(rawData);
        const {chartType, series: seriesOption} = this.originalOptions;

        if (chartType !== 'combo' && snippet.isArray(data.series)) {
            const clonedSeries = data.series;
            data.series = {};
            data.series[chartType] = clonedSeries;
        }

        rawDataHandler.updateRawSeriesDataByOptions(data, seriesOption);

        if (chartType === 'boxplot') {
            rawDataHandler.appendOutliersToSeriesData(data);
        }

        return data;
    }
github nhn / tui.chart / src / js / models / bounds / boundsModel.js View on Github external
registerYAxisDimension: function(limit, componentName, options, theme, isVertical) {
        var categories, yAxisOptions;

        if (limit) {
            categories = [limit.min, limit.max];
        } else if (predicate.isHeatmapChart(this.chartType) || !isVertical) {
            categories = this.dataProcessor.getCategories(true);
        } else {
            return;
        }

        if (snippet.isArray(options)) {
            yAxisOptions = (componentName === 'yAxis') ? options[0] : options[1];
        } else {
            yAxisOptions = options;
        }

        this._registerDimension(componentName, {
            width: axisCalculator.calculateYAxisWidth(categories, yAxisOptions, theme)
        });
    },
github nhn / tui.chart / src / js / models / data / dataProcessor.js View on Github external
_processCategories(type) {
        const rawCategories = this.rawData.categories;
        const categoriesMap = {};

        if (snippet.isArray(rawCategories)) {
            categoriesMap[type] = this._mapCategories(rawCategories, type);
        } else if (rawCategories) {
            if (rawCategories.x) {
                categoriesMap.x = this._mapCategories(rawCategories.x, 'x');
            }

            if (rawCategories.y) {
                categoriesMap.y = this._mapCategories(rawCategories.y, 'y').reverse();
            }
        }

        return categoriesMap;
    }
github nhn / tui.virtual-keyboard / src / js / virtualKeyboard.js View on Github external
_copyArray: function(originalArray, copyArray) {
        if (!snippet.isExisty(originalArray)) {
            return false;
        }
        if (!snippet.isArray(originalArray)) {
            originalArray = [originalArray];
        }
        if (!snippet.isExisty(copyArray) || !snippet.isArray(copyArray)) {
            copyArray = [];
        }

        snippet.forEach(originalArray, function(value, index) {
            copyArray[index] = value;
        }, this);

        return copyArray;
    },
github nhn / tui.chart / src / js / models / data / dataProcessor.js View on Github external
_pushSeriesData(values) {
        if (this.chartType !== 'combo' && snippet.isArray(values)) {
            const temp = values;
            values = {};
            values[this.chartType] = temp;
        }

        Object.entries(this.originalRawData.series).forEach(([seriesType, seriesData]) => {
            this._pushValues(seriesData, values[seriesType], seriesType);
        });
    }
github nhn / tui.chart / src / js / models / data / dataProcessor.js View on Github external
_mapCategories(categories, axisName) {
        const axisType = `${axisName}Axis`;
        const options = this.options[axisType] || {};
        let isDateTime = false;

        if (snippet.isArray(options)) {
            isDateTime = options.filter(option => option.type && predicate.isDatetimeType(option.type));
        } else {
            isDateTime = options.type && predicate.isDatetimeType(options.type);
        }
        if (isDateTime) {
            categories = categories.map(value => this.chageDatetypeToTimestamp(value));
        } else {
            categories = this._escapeCategories(categories);
        }
        this.categoriesIsDateTime[axisName] = isDateTime;

        return categories;
    }
github nhn / tui.chart / src / js / charts / componentManager.js View on Github external
_makeComponentOptions(options, optionKey, componentName, index) {
        options = options || this.options[optionKey];
        options = snippet.isArray(options) ? options[index] : options || {};

        return options;
    }
github nhn / tui.chart / src / js / models / bounds / boundsModel.js View on Github external
registerYAxisDimension(dimensionInfos) {
        const {limit, options, theme, yAxisLabels, isVertical, axisName: componentName} = dimensionInfos;
        const isDiverging = this.options.series && this.options.series.diverging;
        let categories, yAxisOptions;

        if (limit) {
            categories = [limit.min, limit.max];
        } else if (predicate.isHeatmapChart(this.chartType) || !isVertical) {
            categories = this.dataProcessor.getCategories(true);
        } else {
            return;
        }

        if (snippet.isArray(options)) {
            yAxisOptions = (componentName === 'yAxis') ? options[0] : options[1];
        } else {
            yAxisOptions = options;
        }

        this._registerDimension(componentName, {
            width: axisCalculator.calculateYAxisWidth(categories, yAxisOptions, theme, yAxisLabels, isDiverging)
        });
    }
github nhn / tui.chart / src / js / models / data / seriesDataModelForBoxplot.js View on Github external
return this.rawSeriesData.map(rawDatum => {
            const data = snippet.isArray(rawDatum) ? rawDatum : [].concat(rawDatum.data);
            const items = data.map((datum, index) => (
                new SeriesItemForBoxplot({
                    datum,
                    chartType,
                    formatFunctions,
                    index,
                    legendName: rawDatum.name
                })
            ));

            return items;
        });
    }