Skip to content
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

All values in Liquid are truthy except nil and false. #26

Merged
merged 2 commits into from
Mar 21, 2017
Merged

All values in Liquid are truthy except nil and false. #26

merged 2 commits into from
Mar 21, 2017

Conversation

chenos
Copy link
Contributor

@chenos chenos commented Mar 20, 2017

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.001%) to 98.874% when pulling d8119e6 on chenos:master into 2ae6874 on harttle:master.

src/syntax.js Outdated
}

function isFalsy(val) {
return !isTruthy(val);
return false === val || undefined === val;
Copy link
Owner

@harttle harttle Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding, ruby's nil is null or undefined in javascript.

So

return false === val || undefined === val || null === val;

var src = '{% for i in (1..5) reversed limit:2 %}{{ i }}{% endfor %}';
return expect(liquid.parseAndRender(src, ctx))
.to.eventually.equal('21');
});

it('should support for reversed in the first position', function() {
it('should support for reversed in the middle position', function() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.001%) to 98.874% when pulling 7400e06 on chenos:master into 2ae6874 on harttle:master.

@harttle harttle merged commit 6677486 into harttle:master Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants