-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Active tracing configuration (#3928)
Co-authored-by: Thomas Hunter II <[email protected]> Co-authored-by: Igor Unanua <[email protected]> Co-authored-by: simon-id <[email protected]> Co-authored-by: Attila Szegedi <[email protected]>
- Loading branch information
Showing
18 changed files
with
758 additions
and
518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict' | ||
|
||
module.exports = (object, path) => { | ||
const pathArr = path.split('.') | ||
let val = object | ||
for (const p of pathArr) { | ||
if (val === undefined) return val | ||
val = val[p] | ||
} | ||
return val | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict' | ||
|
||
module.exports = (object, path) => { | ||
const pathArr = path.split('.') | ||
let property = object | ||
for (const n of pathArr) { | ||
if (property.hasOwnProperty(n)) { | ||
property = property[n] | ||
} else { | ||
return false | ||
} | ||
} | ||
return true | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict' | ||
|
||
module.exports = (object, path, value) => { | ||
const pathArr = path.split('.') | ||
let property = object | ||
let i | ||
for (i = 0; i < pathArr.length - 1; i++) { | ||
const n = pathArr[i] | ||
if (property.hasOwnProperty(n)) { | ||
property = property[n] | ||
} else { | ||
property[n] = property = {} | ||
} | ||
} | ||
property[pathArr[i]] = value | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict' | ||
|
||
require('../../../../dd-trace/test/setup/tap') | ||
|
||
const { expect } = require('chai') | ||
const get = require('../../../src/utils/src/get') | ||
|
||
describe('get', () => { | ||
const obj = { | ||
'a': { | ||
'b': 'c' | ||
} | ||
} | ||
|
||
it('should return value at path', () => { | ||
expect(get(obj, 'a.b')).to.be.equal('c') | ||
}) | ||
|
||
it('should return undefined if path does not exist', () => { | ||
expect(get(obj, 'd')).to.be.undefined | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict' | ||
|
||
require('../../../../dd-trace/test/setup/tap') | ||
|
||
const { expect } = require('chai') | ||
const has = require('../../../src/utils/src/has') | ||
|
||
describe('has', () => { | ||
const obj = { | ||
'a': { | ||
'b': 'c' | ||
} | ||
} | ||
|
||
it('should true if path exists', () => { | ||
expect(has(obj, 'a.b')).to.be.true | ||
}) | ||
|
||
it('should return false if path does not exist', () => { | ||
expect(has(obj, 'd')).to.be.false | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict' | ||
|
||
require('../../../../dd-trace/test/setup/tap') | ||
|
||
const { expect } = require('chai') | ||
const set = require('../../../src/utils/src/set') | ||
|
||
describe('set', () => { | ||
const obj = {} | ||
|
||
it('should set value at path', () => { | ||
set(obj, 'a.b', 'c') | ||
expect(obj.a.b).to.be.equal('c') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.