How to use the trim.right function in trim

To help you get started, we’ve selected a few trim 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 mulesoft / api-notebook / public / scripts / lib / codemirror / strip-input.js View on Github external
var stripInput = function (prevPosition, cm, string) {
  var endPosition = { ch: Infinity, line: Infinity };
  var text        = cm.doc.getRange(prevPosition, endPosition);

  // Remove everything after the position
  cm.doc.replaceRange('', prevPosition, endPosition);

  // Trim and/or remove the last line if it is now empty
  var lastLine = trim.right(cm.doc.getLine(cm.doc.lastLine()));

  if (lastLine) {
    cm.doc.setLine(cm.doc.lastLine(), lastLine);
  } else {
    cm.doc.removeLine(cm.doc.lastLine());
  }

  return trim.left(text.substr(string.length));
};

trim

Trim string whitespace

MIT
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis

Popular trim functions