How to use the tui-code-snippet.pluck 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.calendar / test / app / common / vlayout.spec.js View on Github external
it('resize at 1 splitter between 2 panels.', function() {
            inst.addPanels([
                {height: 100}, // 100,  100
                {isSplitter: true}, //
                {height: 100} // 100,  205
            ], inst.container);
            spyOn(util, 'forEach');
            inst._resize(inst.panels[1], 100, 110);

            // The first panel increased by 10, and the second panel decreased by 10)
            allArgs = util.pluck(util.forEach.calls.argsFor(0)[0], 1);

            expect(allArgs).toEqual([110, 90]);
        });
github nhn / tui.calendar / test / app / common / array.spec.js View on Github external
start: '2015/05/03 12:00:00',
                    end: '2015/05/03 12:10:00'
                }, {
                    title: 'B',
                    isAllDay: false,
                    start: '2015/05/03 12:00:00',
                    end: '2015/05/03 12:20:00'
                }];

                util.forEach(fixtures, function(data) {
                    schedules.push(Schedule.create(data));
                });

                schedules.sort(array.compare.schedule.asc);

                expect(util.pluck(schedules, 'title')).toEqual(expected);
            });
        });
github nhn / tui.editor / src / js / extensions / table / wwMergedTableManager.js View on Github external
_isPossibleToPaste(tableData, startCellIndex, endCellIndex) {
    const startRowIndex = startCellIndex.rowIndex;
    const startColIndex = startCellIndex.colIndex;
    const endRowIndex = endCellIndex.rowIndex;
    const endColIndex = endCellIndex.colIndex;
    const filterdTableData = tableData.slice(startRowIndex, endRowIndex + 1);
    const firstRow = filterdTableData[0].slice(startColIndex, endColIndex + 1);
    let isPossible = !any(firstRow, cellData => util.isExisty(cellData.rowMergeWith));

    if (isPossible) {
      const firstCells = util.pluck(filterdTableData, startColIndex);

      isPossible = !any(firstCells, cellData => util.isExisty(cellData.colMergeWith));
    }

    if (isPossible && tableData.length > endRowIndex + 1) {
      const nextRow = tableData[endRowIndex + 1].slice(startColIndex, endColIndex + 1);

      isPossible = !any(nextRow, cellData => util.isExisty(cellData.rowMergeWith));
    }

    if (isPossible && tableData[0].length > endColIndex + 1) {
      const nextCells = util.pluck(filterdTableData, endColIndex + 1);

      isPossible = !any(nextCells, cellData => util.isExisty(cellData.colMergeWith));
    }
github nhn / tui.chart / src / js / models / data / seriesDataModelForTreemap.js View on Github external
filtered.forEach((datum, index) => {
            datum.depth = depth;
            datum.group = snippet.isUndefined(group) ? index : group;

            const descendants = this._setTreeProperties(rejected, childDepth, datum.id, datum.group, datum.fillOpacity);
            const children = descendants.filter(descendant => descendant.depth === childDepth);

            if (children.length) {
                datum.value = calculator.sum(snippet.pluck(children, 'value'));
                datum.hasChild = true;
            } else {
                datum.hasChild = false;
            }

            if (descendants.length) {
                descendants.sort((a, b) => (b.value - a.value));
            }

            filtered = filtered.concat(descendants);
        });
github nhn / tui.chart / src / js / models / data / seriesDataModelForTreemap.js View on Github external
_setRatio(flatSeriesData, parent) {
        const parted = this._partitionRawSeriesDataByParent(flatSeriesData, parent);
        const [filtered, rejected] = parted;
        const total = calculator.sum(snippet.pluck(filtered, 'value'));

        filtered.forEach(datum => {
            const value = snippet.isNull(datum.value) ? 0 : datum.value;

            datum.ratio = value / total;

            if (datum.hasChild) {
                this._setRatio(rejected, datum.id);
            }
        });
    }
github nhn / tui.chart / src / js / models / data / mapChartDataProcessor.js View on Github external
getValues() {
        return snippet.pluck(this.getValueMap(), 'value');
    }
github nhn / tui.editor / src / js / extensions / table / wwMergedTableManager.js View on Github external
let isPossible = !any(firstRow, cellData => util.isExisty(cellData.rowMergeWith));

    if (isPossible) {
      const firstCells = util.pluck(filterdTableData, startColIndex);

      isPossible = !any(firstCells, cellData => util.isExisty(cellData.colMergeWith));
    }

    if (isPossible && tableData.length > endRowIndex + 1) {
      const nextRow = tableData[endRowIndex + 1].slice(startColIndex, endColIndex + 1);

      isPossible = !any(nextRow, cellData => util.isExisty(cellData.rowMergeWith));
    }

    if (isPossible && tableData[0].length > endColIndex + 1) {
      const nextCells = util.pluck(filterdTableData, endColIndex + 1);

      isPossible = !any(nextCells, cellData => util.isExisty(cellData.colMergeWith));
    }

    return isPossible;
  }
github nhn / tui.chart / src / js / charts / mapChartMapModel.js View on Github external
_findBoundFromCoordinates(coordinates) {
        const xs = snippet.pluck(coordinates, 'x').filter(x => (!snippet.isUndefined(x)));
        const ys = snippet.pluck(coordinates, 'y').filter(y => (!snippet.isUndefined(y)));
        const maxLeft = arrayUtil.max(xs);
        const minLeft = arrayUtil.min(xs);
        const maxTop = arrayUtil.max(ys);
        const minTop = arrayUtil.min(ys);

        return {
            dimension: {
                width: maxLeft - minLeft,
                height: maxTop - minTop
            },
            position: {
                left: minLeft,
                top: minTop
            }
        };
    }
github nhn / tui.chart / src / js / models / data / seriesDataModelForTreemap.js View on Github external
filtered.forEach((datum, index) => {
            datum.depth = depth;
            datum.group = snippet.isUndefined(group) ? index : group;

            const descendants = this._setTreeProperties(rejected, childDepth, datum.id, datum.group, datum.fillOpacity);
            const children = descendants.filter(descendant => descendant.depth === childDepth);

            if (children.length) {
                datum.value = calculator.sum(snippet.pluck(children, 'value'));
                datum.hasChild = true;
            } else {
                datum.hasChild = false;
            }

            if (descendants.length) {
                descendants.sort((a, b) => (b.value - a.value));
            }

            filtered = filtered.concat(descendants);
        });