Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « trim-trailing-lines « node_modules « eslint « tools - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 41356676eedf469ff2f8972f95debbd4335541af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';

module.exports = trimTrailingLines;

var line = '\n';

/* Remove final newline characters from `value`. */
function trimTrailingLines(value) {
  var val = String(value);
  var index = val.length;

  while (val.charAt(--index) === line) { /* empty */ }

  return val.slice(0, index + 1);
}