-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add toArray filter and expose it to nunjucks
- Loading branch information
Thomas Parisot
committed
Dec 17, 2017
1 parent
c64f808
commit 1478019
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
var _ = require('lodash'); | ||
|
||
function toArray(value) { | ||
if (_.isObject(value) && typeof value.toArray === 'function') { | ||
return value.toArray(); | ||
} | ||
|
||
return value; | ||
} | ||
|
||
module.exports = toArray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters