Louis Grellet
Louis Grellet

Reputation: 1093

lowercase with Jade template

I'm using jade in a nodejs project

Can't find how to define filters

I have categories that i want to display in a select box, lowercase option values and uppercase option text

select
  each cat in categories
    option(value="lowercase(#{cat})") uppercase(#{cat})

any idea ?

Upvotes: 7

Views: 8952

Answers (2)

Gaoping
Gaoping

Reputation: 289

You can also use:

select
  each cat in categories
    option(value=#{cat.toLowerCase()}) #{cat.toUpperCase()}

Upvotes: 4

Amberlamps
Amberlamps

Reputation: 40478

Why are you not using the native JavaScript functions to do so?

select
  each cat in categories
    option(value=cat.toLowerCase())= cat.toUpperCase()

Upvotes: 12

Related Questions