Kanso.js is a tool to easily let you build couchapps. As can be read in the documentation it includes the underscore.js module.
But how can I exactly make use of the underscore.js methods in, let’s say, a list view? Do I have to require it first? For example I have been playing around a but with the union method:
var newArray = oldArray1.union(oldArray2)
or
var newArray = union(oldArray1, oldArray2)
However, Kanso keeps on raising a typeError when requesting the list over HTTP.
First
requiretheunderscoremodule at the top of your file. If you’re on thedevbranch of Kanso (version 0.0.8), It looks like this:In Kanso 0.0.7 it will look like this:
Then call
unionfrom the underscore objectEdit:
In Kanso 0.2.1 (the current version at the time of writing), underscore has it’s own package. Here’s how to use it:
Add
underscoreas a dependency in your kanso.json file.Run
kanso installin your project directory.Require
underscorein a module.