Skip to content

Commit

Permalink
Do not add is_singular to singulars that retain the original name (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
daogrady authored Jun 25, 2024
1 parent b1d7812 commit be0e48f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Version 0.23.0 - TBD
### Fixed
- Plurals no longer have `is_singular` attached in the resulting .js files

## Version 0.22.0 - 2024-06-20
### Fixed
Expand Down
6 changes: 5 additions & 1 deletion lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ class SourceFile extends File {
// This could be an issue when the user re-used the original name in a @singular/@plural annotation.
// Seems unlikely, but we have to eliminate the original entry if users start running into this.
if (singular !== original) {
exports.push(`module.exports.${original} = { is_singular: true, __proto__: csn.${original} }`)
// do not do the is_singular spiel if the original name is used for the plural
const rhs = plural === original
? `csn.${original}`
: `{ is_singular: true, __proto__: csn.${original} }`
exports.push(`module.exports.${original} = ${rhs}`)
}
return exports
})
Expand Down

0 comments on commit be0e48f

Please sign in to comment.