@@ -237,7 +237,7 @@ function logValue(
237237 value , // : any,
238238 operation , // : string, // from JSOperation object please
239239 callContext , // : any,
240- logSettings = false , // : LogSettings,
240+ logSettings : typeof jsInstrumentationSettings [ 0 ] | { logFunctionsAsStrings : boolean } = { logFunctionsAsStrings : false } , // : LogSettings,
241241) {
242242 if ( inLog ) {
243243 return ;
@@ -327,7 +327,16 @@ function logCall(instrumentedFunctionName, args, callContext, _logSettings) {
327327/**
328328 * Provides the properties per prototype object
329329 */
330- Object . getPrototypeByDepth = function ( subject , depth ) {
330+
331+ declare global {
332+ interface Object {
333+ getPrototypeByDepth ( subject : string | undefined , depth : number ) : any
334+ getPropertyNamesPerDepth ( subject : any , maxDepth : number ) : any
335+ findPropertyInChain ( subject , propertyName )
336+ }
337+ }
338+
339+ Object . prototype . getPrototypeByDepth = function ( subject , depth ) {
331340 if ( subject === undefined ) {
332341 throw new Error ( "Can't get property names for undefined" ) ;
333342 }
@@ -348,7 +357,7 @@ Object.getPrototypeByDepth = function (subject, depth) {
348357 * Traverses the prototype chain to collect properties. Returns an array containing
349358 * an object with the depth, propertyNames and scanned subject
350359 */
351- Object . getPropertyNamesPerDepth = function ( subject , maxDepth = 0 ) {
360+ Object . prototype . getPropertyNamesPerDepth = function ( subject , maxDepth = 0 ) {
352361 if ( subject === undefined ) {
353362 throw new Error ( "Can't get property names for undefined" ) ;
354363 }
@@ -370,7 +379,7 @@ Object.getPropertyNamesPerDepth = function (subject, maxDepth = 0) {
370379/**
371380 * Finds a property along the prototype chain
372381 */
373- Object . findPropertyInChain = function ( subject , propertyName ) {
382+ Object . prototype . findPropertyInChain = function ( subject , propertyName ) {
374383 if ( subject === undefined || propertyName === undefined ) {
375384 throw new Error ( "Object and property name must be defined" ) ;
376385 }
@@ -457,9 +466,9 @@ function notify(type, content) {
457466 } ) ;
458467}
459468
460- function filterPropertiesPerDepth ( collection , excluded ) {
461- for ( let i = 0 ; i < collection . length ; i ++ ) {
462- collection [ i ] . propertyNames = collection [ i ] . propertyNames . filter (
469+ function filterPropertiesPerDepth < T > ( collection : { propertyNames : T [ ] } [ ] , excluded : T [ ] ) {
470+ for ( const elem of collection ) {
471+ elem . propertyNames = elem . propertyNames . filter (
463472 ( p ) => ! excluded . includes ( p ) ,
464473 ) ;
465474 }
0 commit comments