Skip to content

Commit

Permalink
1. convert ignoreCase to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
andxu committed Mar 8, 2018
1 parent bd84233 commit 17516a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/yaml-support/yaml-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function getYamlMappingValue(mapRootNode: YamlMap, key: string,
return undefined;
}
const keyValueItem = mapRootNode.mappings.find((mapping) => mapping.key &&
(ignoreCase ? key === mapping.key.raw : equalIgnoreCase(key, mapping.key.raw)));
(ignoreCase === StringComparison.OrdinalIgnoreCase ? key === mapping.key.raw : equalIgnoreCase(key, mapping.key.raw)));
return keyValueItem ? keyValueItem.value.raw : undefined;
}

Expand All @@ -115,7 +115,7 @@ function getStringValue(node, key: string, ignoreCase: StringComparison = String
if (node.hasOwnProperty(key)) {
return <string>node[key];
}
if (ignoreCase) {
if (ignoreCase === StringComparison.OrdinalIgnoreCase) {
for (const _key of Object.keys(node)) {
if (equalIgnoreCase(key, _key)) {
return <string>node[_key];
Expand Down

0 comments on commit 17516a5

Please sign in to comment.