UNPKG

csv-loader

Version:

A webpack module to intelligently load csv files.

15 lines (10 loc) 314 B
var Papa = require('papaparse'); var loaderUtils = require('loader-utils'); module.exports = function (text) { var config = loaderUtils.getOptions(this); var parsed = Papa.parse(text, config); if (this.cacheable) { this.cacheable(); } return 'module.exports = ' + JSON.stringify(parsed.data); };