main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
569 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 | "use strict";
|
---|
6 |
|
---|
7 | class Source {
|
---|
8 | source() {
|
---|
9 | throw new Error("Abstract");
|
---|
10 | }
|
---|
11 |
|
---|
12 | buffer() {
|
---|
13 | const source = this.source();
|
---|
14 | if (Buffer.isBuffer(source)) return source;
|
---|
15 | return Buffer.from(source, "utf-8");
|
---|
16 | }
|
---|
17 |
|
---|
18 | size() {
|
---|
19 | return this.buffer().length;
|
---|
20 | }
|
---|
21 |
|
---|
22 | map(options) {
|
---|
23 | return null;
|
---|
24 | }
|
---|
25 |
|
---|
26 | sourceAndMap(options) {
|
---|
27 | return {
|
---|
28 | source: this.source(),
|
---|
29 | map: this.map(options)
|
---|
30 | };
|
---|
31 | }
|
---|
32 |
|
---|
33 | updateHash(hash) {
|
---|
34 | throw new Error("Abstract");
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | module.exports = Source;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.