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

请问,如何在模板里判断数据类型 #19

Closed
pulo opened this issue Nov 9, 2012 · 1 comment
Closed

请问,如何在模板里判断数据类型 #19

pulo opened this issue Nov 9, 2012 · 1 comment

Comments

@pulo
Copy link

pulo commented Nov 9, 2012

如题,我要判断是否为Array~~~应该怎么写

@PaulGuo
Copy link
Owner

PaulGuo commented Nov 10, 2012

可自定义helper方法解决:

juicer.register('is_array', function(obj) {
    return Object.prototype.toString.call(obj) === '[object Array]';    
});
{@if is_array(something)} do something {@/if}

@PaulGuo PaulGuo closed this as completed Nov 10, 2012
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

No branches or pull requests

2 participants