source: trip-planner-front/node_modules/karma/lib/url.js@ 59329aa

Last change on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 573 bytes
RevLine 
[6a3a178]1'use strict'
2
3const path = require('path')
4const { URL } = require('url')
5
6/**
7 * Url object used for tracking files in `file-list.js`.
8 */
9class Url {
10 constructor (path, type) {
11 this.path = path
12 this.originalPath = path
13 this.type = type
14 this.isUrl = true
15 }
16
17 /**
18 * Detect type from the file extension in the path part of the URL.
19 * @returns {string} detected file type or empty string
20 */
21 detectType () {
22 return path.extname(new URL(this.path).pathname).substring(1)
23 }
24
25 toString () {
26 return this.path
27 }
28}
29
30module.exports = Url
Note: See TracBrowser for help on using the repository browser.