@@ -4,22 +4,12 @@ const {
44 ArrayPrototypeMap,
55 JSONParse,
66 ObjectKeys,
7- ObjectGetOwnPropertyDescriptor,
8- ObjectPrototypeHasOwnProperty,
97 RegExpPrototypeExec,
108 RegExpPrototypeSymbolSplit,
119 SafeMap,
1210 StringPrototypeSplit,
1311} = primordials ;
1412
15- function ObjectGetValueSafe ( obj , key ) {
16- const desc = ObjectGetOwnPropertyDescriptor ( obj , key ) ;
17- if ( desc === undefined ) {
18- return undefined ;
19- }
20- return ObjectPrototypeHasOwnProperty ( desc , 'value' ) ? desc . value : undefined ;
21- }
22-
2313// See https://sourcemaps.info/spec.html for SourceMap V3 specification.
2414const { Buffer } = require ( 'buffer' ) ;
2515let debug = require ( 'internal/util/debuglog' ) . debuglog ( 'source_map' , ( fn ) => {
@@ -301,11 +291,11 @@ function sourceMapCacheToObject() {
301291
302292function appendCJSCache ( obj ) {
303293 for ( const value of getCjsSourceMapCache ( ) ) {
304- obj [ ObjectGetValueSafe ( value , ' filename' ) ] = {
294+ obj [ value . filename ] = {
305295 __proto__ : null ,
306- lineLengths : ObjectGetValueSafe ( value , ' lineLengths' ) ,
307- data : ObjectGetValueSafe ( value , ' data' ) ,
308- url : ObjectGetValueSafe ( value , ' url' )
296+ lineLengths : value . lineLengths ,
297+ data : value . data ,
298+ url : value . url ,
309299 } ;
310300 }
311301}
@@ -320,8 +310,8 @@ function findSourceMap(sourceURL) {
320310 let entry = esmSourceMapCache . get ( sourceURL ) ?? generatedSourceMapCache . get ( sourceURL ) ;
321311 if ( entry === undefined ) {
322312 for ( const value of getCjsSourceMapCache ( ) ) {
323- const filename = ObjectGetValueSafe ( value , ' filename' ) ;
324- const cachedSourceURL = ObjectGetValueSafe ( value , ' sourceURL' ) ;
313+ const filename = value . filename ;
314+ const cachedSourceURL = value . sourceURL ;
325315 if ( sourceURL === filename || sourceURL === cachedSourceURL ) {
326316 entry = value ;
327317 }
@@ -330,9 +320,9 @@ function findSourceMap(sourceURL) {
330320 if ( entry === undefined ) {
331321 return undefined ;
332322 }
333- let sourceMap = ObjectGetValueSafe ( entry , ' sourceMap' ) ;
323+ let sourceMap = entry . sourceMap ;
334324 if ( sourceMap === undefined ) {
335- sourceMap = new SourceMap ( ObjectGetValueSafe ( entry , ' data' ) ) ;
325+ sourceMap = new SourceMap ( entry . data ) ;
336326 entry . sourceMap = sourceMap ;
337327 }
338328 return sourceMap ;
0 commit comments