Skip to content

Commit

Permalink
Revert "simplifyClaims: remove empty claims arrays"
Browse files Browse the repository at this point in the history
This reverts commit e45a7e9.

Addressing the breaking change notified in https://twitter.com/tmtm/status/1573163687841513478
  • Loading branch information
maxlath committed Sep 23, 2022
1 parent f7ffd75 commit ab43174
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
5 changes: 1 addition & 4 deletions lib/helpers/simplify_claims.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ const simplifyClaims = (claims, ...options) => {
if (propertyPrefix) {
id = propertyPrefix + ':' + id
}
const simplifiedPropertyClaims = simplifyPropertyClaims(propClaims, ...options)
if (simplifiedPropertyClaims.length > 0) {
simpleClaims[id] = simplifiedPropertyClaims
}
simpleClaims[id] = simplifyPropertyClaims(propClaims, ...options)
}
return simpleClaims
}
Expand Down
7 changes: 0 additions & 7 deletions test/simplify_claims.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ describe('simplifyPropertyClaims', () => {
simplified.should.deepEqual([ 'Q2044250' ])
})

it('should not return empty claims arrays', () => {
const deprecatedClaim = Q4115189.claims.P135[0]
const claims = { P135: [ deprecatedClaim ] }
const simplified = simplifyClaims(claims)
should(simplified.P135).not.be.ok()
})

it('should return non-truthy statements if requested', () => {
const options = { keepNonTruthy: true }
const simplified = simplifyPropertyClaims(Q4115189.claims.P135, options)
Expand Down

0 comments on commit ab43174

Please sign in to comment.