node/tools/eslint/node_modules/table/dist/wrapString.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

51 lines
1.3 KiB
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _trim2 = require('lodash/trim');
var _trim3 = _interopRequireDefault(_trim2);
var _sliceAnsi = require('slice-ansi');
var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Creates an array of strings split into groups the length of size.
* This function works with strings that contain ASCII characters.
*
* wrapText is different from would-be "chunk" implementation
* in that whitespace characters that occur on a chunk size limit are trimmed.
*
* @param {string} subject
* @param {number} size
* @returns {Array}
*/
exports.default = function (subject, size) {
var chunks = undefined,
subjectSlice = undefined;
subjectSlice = subject;
chunks = [];
do {
chunks.push((0, _sliceAnsi2.default)(subjectSlice, 0, size));
subjectSlice = (0, _trim3.default)((0, _sliceAnsi2.default)(subjectSlice, size));
} while ((0, _stringWidth2.default)(subjectSlice));
return chunks;
};
module.exports = exports['default'];
//# sourceMappingURL=wrapString.js.map