//- ---------------------------------- //- 💫 INCLUDES > FUNCTIONS //- ---------------------------------- //- Add prefixes to items of an array (for modifier CSS classes) - function prefixArgs(array, prefix) { <<<<<<< HEAD - return array.map(function(arg) { - return prefix + '--' + arg; - }).join(' '); ======= - for(var i = 0; i < array.length; i++) { - array[i] = prefix + array[i]; - } - return array.join(' '); - } //- Convert date to human readable and timestamp format input - [string] date in the format YYYY-MM-DD - function convertDate(input) { - var dates = []; - var months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; - var date = new Date(input); - dates.full = months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear(); - dates.timestamp = JSON.parse(JSON.stringify(date)); - return dates; - } //- Convert date to valid RSS pubDate input - [string] date in the format YYYY-MM-DD - function convertPubDate(input) { - var date = new Date(input); - var pieces = date.toString().split(' '); - var offsetTime = pieces[5].match(/[-+]\d{4}/); - var offset = (offsetTime) ? offsetTime : pieces[5]; - var parts = [ pieces[0] + ',', pieces[2], pieces[1], pieces[3], pieces[4], offset ]; - return parts.join(' '); - } //- Compile scrset attribute for hero images image - [object] article image object from _data.json path - [string] relative path to image folder - function getScrset(image, path) { - var scrset = path + image.file + ' ' + image_sizes.medium + 'w'; - if(image.file_small) scrset += ', ' + path + image.file_small + ' ' + image_sizes.small + 'w'; - if(image.file_large) scrset += ', ' + path + image.file_large + ' ' + image_sizes.large + 'w'; - return scrset; - } //- Get meta image - function getMetaImage() { - if(current.path[0] == 'blog' && image && image.file) { - return url + '/blog/img/' + (image.file_small || image.file); - } - else { - return url + '/assets/img/social.png'; - } >>>>>>> v1.0.0-rc1 - }