'use strict';

const path = require('path');

const buildNavigation = function(styleguideArray) {
  let options = this;

  options.navigation = {};

  styleguideArray.forEach((obj) => {
    let fileName = (obj.writeName || obj.title).replace(/ /g, '_').toLowerCase() + '.html';

    options.navigation[obj.title] = fileName;
  });

  return styleguideArray;
};

module.exports = buildNavigation;

'use strict';

const buildNavigation = function(styleguideArray) {
  let options = this,
    _nav = {};

  options.navigation = {};

  styleguideArray.forEach((obj) => {
    let fileName = (obj.writeName || obj.title).replace(/ /g, '_').toLowerCase() + '.html';

    _nav[obj.title] = fileName;
  });

  Object.keys(_nav)
    .sort()
    .forEach(function(v, i) {
      options.navigation[v] = _nav[v];
    });

  return styleguideArray;
};

module.exports = buildNavigation;

Update navigation to be in alphabetical order
Update navigation to be in alphabetical order
