@jsonlines/core
Version:
parse and stringify jsonlines files through streams
72 lines (55 loc) • 1.54 kB
JavaScript
;
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = privateMap.get(receiver);
if (!descriptor) {
throw new TypeError("attempted to get private field on non-instance");
}
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = privateMap.get(receiver);
if (!descriptor) {
throw new TypeError("attempted to set private field on non-instance");
}
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
return value;
}
function getRawLinesSep(option) {
switch (option) {
case "\n":
case "lf":
return "\n";
case "\r\n":
case "crlf":
return "\r\n";
default:
return option;
}
}
function getLineSepSplitter(option) {
const raw = getRawLinesSep(option);
return raw === "auto" ? /\r?\n/ : raw;
}
function isWin() {
return process.platform === "win32";
}
function getLineSepString(option) {
const raw = getRawLinesSep(option);
return raw === "auto" ? //
isWin() ? "\r\n" : "\n" : raw;
}
exports._classPrivateFieldGet = _classPrivateFieldGet;
exports._classPrivateFieldSet = _classPrivateFieldSet;
exports.getLineSepSplitter = getLineSepSplitter;
exports.getLineSepString = getLineSepString;
//# sourceMappingURL=line-sep-69d200dd.js.map