11const lodashGet = require ( "lodash/get" ) ;
22const yaml = require ( "js-yaml" ) ;
33
4- module . exports = function ( eleventyConfig ) {
4+ module . exports = function ( eleventyConfig ) {
55 // Support yaml data files
66 eleventyConfig . addDataExtension ( "yaml" , contents => yaml . safeLoad ( contents ) )
77
@@ -19,7 +19,7 @@ module.exports = function(eleventyConfig) {
1919 const { DateTime } = require ( 'luxon' ) ;
2020 eleventyConfig . addFilter ( 'formatDate' , ( dateObj , formatStr ) => {
2121 // convert any date strings to read dates
22- if ( typeof ( dateObj ) == "string" ) {
22+ if ( typeof ( dateObj ) == "string" ) {
2323 dateObj = new Date ( dateObj ) ;
2424 }
2525 const format = formatStr ? formatStr : 'LLLL d, y' ;
@@ -45,7 +45,7 @@ module.exports = function(eleventyConfig) {
4545 } ) ;
4646
4747
48- eleventyConfig . addCollection ( "resources" , function ( collectionApi ) {
48+ eleventyConfig . addCollection ( "resources" , function ( collectionApi ) {
4949 return collectionApi . getFilteredByGlob ( "src/site/resources/*.md" ) ;
5050 } ) ;
5151
@@ -72,7 +72,7 @@ module.exports = function(eleventyConfig) {
7272
7373 // filter a data array based on the value of a property
7474 eleventyConfig . addFilter ( 'select' , ( array , clause ) => {
75- if ( clause . indexOf ( "=" ) > - 1 ) {
75+ if ( clause . indexOf ( "=" ) > - 1 ) {
7676 const property = clause . split ( "=" ) [ 0 ] ;
7777 const value = clause . split ( "=" ) [ 1 ] ;
7878 return array . filter ( item => lodashGet ( item , property ) . includes ( value ) ) ;
@@ -83,9 +83,9 @@ module.exports = function(eleventyConfig) {
8383
8484 eleventyConfig . addFilter ( 'flatten' , ( array ) => {
8585 let results = [ ] ;
86- for ( let result of array ) {
87- if ( result ) {
88- if ( Array . isArray ( result ) ) {
86+ for ( let result of array ) {
87+ if ( result ) {
88+ if ( Array . isArray ( result ) ) {
8989 results = [ ...results , ...result ] ;
9090 } else {
9191 results . push ( result ) ;
@@ -97,8 +97,8 @@ module.exports = function(eleventyConfig) {
9797
9898 eleventyConfig . addFilter ( 'unique' , ( array ) => {
9999 let caseInsensitive = { } ;
100- for ( let val of array ) {
101- if ( typeof val === "string" ) {
100+ for ( let val of array ) {
101+ if ( typeof val === "string" ) {
102102 caseInsensitive [ val . toLowerCase ( ) ] = val ;
103103 }
104104 }
@@ -110,15 +110,15 @@ module.exports = function(eleventyConfig) {
110110 if ( count > array . length ) {
111111 count = array . length ;
112112 }
113- const shuffled = array . sort ( ( ) => 0.5 - Math . random ( ) ) ;
113+ const shuffled = array . sort ( ( ) => 0.5 - Math . random ( ) ) ;
114114 return shuffled . slice ( 0 , count ) ;
115115 } ) ;
116116
117117 // Convert an associative array into an indexable, iterable array
118118 eleventyConfig . addFilter ( 'iterable' , ( obj ) => {
119119 var iterableArray = new Array ( ) ;
120- for ( var item in obj ) {
121- iterableArray . push ( obj [ item ] ) ;
120+ for ( var item in obj ) {
121+ iterableArray . push ( obj [ item ] ) ;
122122 }
123123 return iterableArray ;
124124 } ) ;
@@ -142,9 +142,9 @@ module.exports = function(eleventyConfig) {
142142 return arr . sort ( ( a , b ) => {
143143 let aKey = lodashGet ( a , selector ) . toLowerCase ( ) ;
144144 let bKey = lodashGet ( b , selector ) . toLowerCase ( ) ;
145- if ( aKey < bKey ) {
145+ if ( aKey < bKey ) {
146146 return - 1 ;
147- } else if ( aKey > bKey ) {
147+ } else if ( aKey > bKey ) {
148148 return 1 ;
149149 }
150150 return 0 ;
@@ -155,9 +155,9 @@ module.exports = function(eleventyConfig) {
155155 return arr . sort ( ( a , b ) => {
156156 let aKey = githubData [ a . data . repo ] ? ( githubData [ a . data . repo ] . stars || 0 ) : 0 ;
157157 let bKey = githubData [ b . data . repo ] ? ( githubData [ b . data . repo ] . stars || 0 ) : 0 ;
158- if ( aKey < bKey ) {
158+ if ( aKey < bKey ) {
159159 return 1 ;
160- } else if ( aKey > bKey ) {
160+ } else if ( aKey > bKey ) {
161161 return - 1 ;
162162 }
163163 return 0 ;
@@ -168,11 +168,11 @@ module.exports = function(eleventyConfig) {
168168 // Format a path to avoid any Cloudinary URL API miss-steps.
169169 eleventyConfig . addFilter ( "cloudinaryifyPath" , ( str ) => {
170170
171- if ( str ) {
172-
171+ if ( str ) {
172+
173173 // add generic url encoding
174174 str = encodeURI ( str ) ;
175-
175+
176176 // we also need to double escape some characters which might appear in text
177177 // but are meaningful in cloudinary URLs
178178 str = str . replace ( / , / g, '%252C' ) ;
@@ -189,7 +189,7 @@ module.exports = function(eleventyConfig) {
189189 eleventyConfig . addPassthroughCopy ( "src/site/site.webmanifest" ) ;
190190 eleventyConfig . addPassthroughCopy ( "src/site/survey/2021/community-survey-2021-methodology.pdf" ) ;
191191
192- return {
192+ return {
193193 dir : {
194194 input : "src/site" ,
195195 inludes : "_includes" ,
0 commit comments