UNPKG

slate-edit-code

Version:

A Slate plugin to handle keyboard events in code blocks.

15 lines (12 loc) 288 B
'use strict'; var detectNewline = require('detect-newline'); var DEFAULT = '\n'; /** * Detect the dominant newline character of a string * @param {String} text * @return {String} */ function getNewLine(text) { return detectNewline(text) || DEFAULT; } module.exports = getNewLine;