node/tools/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js
Rich Trott 7268bb1847 tools: update ESLint to version 2.1.0
Update ESLint to 2.1.0. ESLint has a number of potentially-useful new
features but this change attempts to be minimal in its changes.
However, some things could not be avoided reasonably.

ESLint 2.1.0 found a few lint issues that ESLing 1.x missed with
template strings that did not take advantage of any features of
template strings, and `let` declarations where `const` sufficed.

Additionally, ESLint 2.1.0 removes some granularity around enabling ES6
features. Some features (e.g., spread operator) that had been turned off
in our configuration for ESLint 1.x are now permitted.

PR-URL: https://github.com/nodejs/node/pull/5214
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-03-02 14:01:11 -08:00

86 lines
2.4 KiB
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _flatten2 = require('lodash/flatten');
var _flatten3 = _interopRequireDefault(_flatten2);
var _forEach2 = require('lodash/forEach');
var _forEach3 = _interopRequireDefault(_forEach2);
var _fill2 = require('lodash/fill');
var _fill3 = _interopRequireDefault(_fill2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _wrapString = require('./wrapString');
var _wrapString2 = _interopRequireDefault(_wrapString);
var _wrapWord = require('./wrapWord');
var _wrapWord2 = _interopRequireDefault(_wrapWord);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {Array} unmappedRows
* @param {number[]} rowHeightIndex
* @param {Object} config
* @return {Array}
*/
exports.default = function (unmappedRows, rowHeightIndex, config) {
var mappedRows = undefined,
tableWidth = undefined;
tableWidth = unmappedRows[0].length;
// console.log('unmappedRows', unmappedRows, 'rowHeightIndex', rowHeightIndex, 'config', config, 'tableWidth', tableWidth);
mappedRows = (0, _map3.default)(unmappedRows, function (cells, index0) {
var rowHeight = undefined;
rowHeight = (0, _map3.default)(Array(rowHeightIndex[index0]), function () {
return (0, _fill3.default)(Array(tableWidth), '');
});
// console.log('rowHeight', rowHeight);
// rowHeight
// [{row index within rowSaw; index2}]
// [{cell index within a virtual row; index1}]
(0, _forEach3.default)(cells, function (value, index1) {
var chunkedValue = undefined;
if (config.columns[index1].wrapWord) {
chunkedValue = (0, _wrapWord2.default)(value, config.columns[index1].width);
} else {
chunkedValue = (0, _wrapString2.default)(value, config.columns[index1].width);
}
// console.log('chunkedValue', chunkedValue.length, 'rowHeight', rowHeight.length);
(0, _forEach3.default)(chunkedValue, function (part, index2) {
// console.log(rowHeight[index2]);
rowHeight[index2][index1] = part;
});
});
return rowHeight;
});
return (0, _flatten3.default)(mappedRows);
};
module.exports = exports['default'];
//# sourceMappingURL=mapDataUsingRowHeightIndex.js.map