WME/aufgabe5/node_modules/csvtojson/v2/util.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-01-09 11:25:28 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function bufFromString(str) {
var length = Buffer.byteLength(str);
var buffer = Buffer.allocUnsafe
? Buffer.allocUnsafe(length)
: new Buffer(length);
buffer.write(str);
return buffer;
}
exports.bufFromString = bufFromString;
function emptyBuffer() {
var buffer = Buffer.allocUnsafe
? Buffer.allocUnsafe(0)
: new Buffer(0);
return buffer;
}
exports.emptyBuffer = emptyBuffer;
function filterArray(arr, filter) {
var rtn = [];
for (var i = 0; i < arr.length; i++) {
if (filter.indexOf(i) > -1) {
rtn.push(arr[i]);
}
}
return rtn;
}
exports.filterArray = filterArray;
exports.trimLeft = String.prototype.trimLeft ? function trimLeftNative(str) {
return str.trimLeft();
} : function trimLeftRegExp(str) {
return str.replace(/^\s+/, "");
};
exports.trimRight = String.prototype.trimRight ? function trimRightNative(str) {
return str.trimRight();
} : function trimRightRegExp(str) {
return str.replace(/\s+$/, "");
};
//# sourceMappingURL=util.js.map