Skip to content

Commit

Permalink
Rename property
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichon-msft committed May 18, 2021
1 parent d7a0e15 commit ace7a88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"changes": [
{
"packageName": "@rushstack/node-core-library",
"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.",
"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.",
"type": "minor"
}
],
Expand Down
4 changes: 2 additions & 2 deletions libraries/node-core-library/src/JsonFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface IJsonFileStringifyOptions {
* If true, conforms to the standard behavior of JSON.stringify() when a property has the value `undefined`.
* Specifically, the key will be dropped from the emitted object.
*/
dropUndefinedValues?: boolean;
ignoreUndefinedValues?: boolean;

/**
* If true, then the "jju" library will be used to improve the text formatting.
Expand Down Expand Up @@ -236,7 +236,7 @@ export class JsonFile {
options = {};
}

if (!options.dropUndefinedValues) {
if (!options.ignoreUndefinedValues) {
// Standard handling of `undefined` in JSON stringification is to discard the key.
JsonFile.validateNoUndefinedMembers(newJsonObject);
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/node-core-library/src/test/JsonFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('JsonFile tests', () => {
JsonFile.stringify(
{ abc: undefined },
{
dropUndefinedValues: true
ignoreUndefinedValues: true
}
)
).toMatchSnapshot();
Expand All @@ -41,7 +41,7 @@ describe('JsonFile tests', () => {
JsonFile.stringify(
{ abc: undefined },
{
dropUndefinedValues: true,
ignoreUndefinedValues: true,
prettyFormatting: true
}
)
Expand Down

0 comments on commit ace7a88

Please sign in to comment.