Skip to content

Commit ace7a88

Browse files
committed
Rename property
1 parent d7a0e15 commit ace7a88

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

common/changes/@rushstack/node-core-library/json-file-undefined_2021-05-13-21-25.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"changes": [
33
{
44
"packageName": "@rushstack/node-core-library",
5-
"comment": "Add `dropUndefinedValues` option to JSONFile to discard keys with undefined values during serialization, i.e. the standard behavior of JSON.stringify() and other JSON serializers.",
5+
"comment": "Add `ignoreUndefinedValues` option to JSONFile to discard keys with undefined values during serialization, i.e. the standard behavior of JSON.stringify() and other JSON serializers.",
66
"type": "minor"
77
}
88
],

libraries/node-core-library/src/JsonFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface IJsonFileStringifyOptions {
5353
* If true, conforms to the standard behavior of JSON.stringify() when a property has the value `undefined`.
5454
* Specifically, the key will be dropped from the emitted object.
5555
*/
56-
dropUndefinedValues?: boolean;
56+
ignoreUndefinedValues?: boolean;
5757

5858
/**
5959
* If true, then the "jju" library will be used to improve the text formatting.
@@ -236,7 +236,7 @@ export class JsonFile {
236236
options = {};
237237
}
238238

239-
if (!options.dropUndefinedValues) {
239+
if (!options.ignoreUndefinedValues) {
240240
// Standard handling of `undefined` in JSON stringification is to discard the key.
241241
JsonFile.validateNoUndefinedMembers(newJsonObject);
242242
}

libraries/node-core-library/src/test/JsonFile.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('JsonFile tests', () => {
3232
JsonFile.stringify(
3333
{ abc: undefined },
3434
{
35-
dropUndefinedValues: true
35+
ignoreUndefinedValues: true
3636
}
3737
)
3838
).toMatchSnapshot();
@@ -41,7 +41,7 @@ describe('JsonFile tests', () => {
4141
JsonFile.stringify(
4242
{ abc: undefined },
4343
{
44-
dropUndefinedValues: true,
44+
ignoreUndefinedValues: true,
4545
prettyFormatting: true
4646
}
4747
)

0 commit comments

Comments
 (0)