UNPKG

jsmodern

Version:

An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.

13 lines 397 B
const NEWLINE_REGEXP = /\r?\n/i; export const lines = { label: 'lines', fn: function stringLines() { const ctx = this; if (!ctx.length) return []; const strArray = ctx.split(NEWLINE_REGEXP); const isEmptyStr = '' === strArray.slice(-1)[0]; return isEmptyStr ? strArray.slice(0, -1) : strArray; }, }; //# sourceMappingURL=lines.js.map