1
1
"use strict" ;
2
- const path = require ( "path" ) ;
3
2
const whatwgURL = require ( "whatwg-url" ) ;
4
3
const { domSymbolTree } = require ( "./living/helpers/internal-constants" ) ;
5
4
const SYMBOL_TREE_POSITION = require ( "symbol-tree" ) . TreePosition ;
6
5
7
- exports . toFileUrl = function ( fileName ) {
8
- // Beyond just the `path.resolve`, this is mostly for the benefit of Windows,
9
- // where we need to convert "\" to "/" and add an extra "/" prefix before the
10
- // drive letter.
11
- let pathname = path . resolve ( process . cwd ( ) , fileName ) . replace ( / \\ / g, "/" ) ;
12
- if ( pathname [ 0 ] !== "/" ) {
13
- pathname = "/" + pathname ;
14
- }
15
-
16
- // path might contain spaces, so convert those to %20
17
- return "file://" + encodeURI ( pathname ) ;
18
- } ;
19
-
20
6
/**
21
7
* Define a set of properties on an object, by copying the property descriptors
22
8
* from the original object.
@@ -31,29 +17,6 @@ exports.define = function define(object, properties) {
31
17
}
32
18
} ;
33
19
34
- /**
35
- * Define a list of constants on a constructor and its .prototype
36
- *
37
- * - `Constructor` {Function} the constructor to define the constants on
38
- * - `propertyMap` {Object} key/value map of properties to define
39
- */
40
- exports . addConstants = function addConstants ( Constructor , propertyMap ) {
41
- for ( const property in propertyMap ) {
42
- const value = propertyMap [ property ] ;
43
- addConstant ( Constructor , property , value ) ;
44
- addConstant ( Constructor . prototype , property , value ) ;
45
- }
46
- } ;
47
-
48
- function addConstant ( object , property , value ) {
49
- Object . defineProperty ( object , property , {
50
- configurable : false ,
51
- enumerable : true ,
52
- writable : false ,
53
- value
54
- } ) ;
55
- }
56
-
57
20
exports . mixin = ( target , source ) => {
58
21
const keys = Reflect . ownKeys ( source ) ;
59
22
for ( let i = 0 ; i < keys . length ; ++ i ) {
0 commit comments