-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alias support - fixes #30 #31
Conversation
5a91dd3
to
155a4f3
Compare
@maranomynet plz review an merge if you are ok with it. I'll do a release then. |
Should the order of keys in the translations object matter? i.e. should this test pass? it('should be agnostic to the order of key declarations', function () {
expect(translate.resolveAliases({
C: '< {{B}} >',
B: 'foo {{A}} bar',
A: 'bar',
})).to.eql(translate.resolveAliases({
A: 'bar',
B: 'foo {{A}} bar',
C: '< {{B}} >',
}))
}) Supporting this would require a slightly more complicated resolution algorithm, but not that much. |
It seems that the circular reference detection isn't only detecting circular references. |
Also, I would have expected this test to pass: it('should allow multiple aliases per string', function () {
expect(translate.resolveAliases({
A: 'bar',
B: 'foo {{A}} {{A}}',
C: 'foo {{B}} {{A}}'
})).to.eql({
A: 'bar',
B: 'foo bar bar',
B: 'foo foo bar bar bar'
})
}) |
I pushed the failing tests just in case... feel free to revert aaebaad if you think either of these is unreasonable or unnecessary atm. |
Thanks. Just tried to fix this... not trivial. |
aaebaad
to
921034c
Compare
921034c
to
3035375
Compare
ok, just found a simple solution. Feel free to check again |
Looks great. I can't think of any other missing features. |
No description provided.