source: imaps-frontend/node_modules/webpack-sources/lib/helpers/streamChunksOfRawSource.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 866 bytes
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const getGeneratedSourceInfo = require("./getGeneratedSourceInfo");
9const splitIntoLines = require("./splitIntoLines");
10
11const streamChunksOfRawSource = (source, onChunk, onSource, onName) => {
12 let line = 1;
13 const matches = splitIntoLines(source);
14 let match;
15 for (match of matches) {
16 onChunk(match, line, 0, -1, -1, -1, -1);
17 line++;
18 }
19 return matches.length === 0 || match.endsWith("\n")
20 ? {
21 generatedLine: matches.length + 1,
22 generatedColumn: 0
23 }
24 : {
25 generatedLine: matches.length,
26 generatedColumn: match.length
27 };
28};
29
30module.exports = (source, onChunk, onSource, onName, finalSource) => {
31 return finalSource
32 ? getGeneratedSourceInfo(source)
33 : streamChunksOfRawSource(source, onChunk, onSource, onName);
34};
Note: See TracBrowser for help on using the repository browser.