'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function sortByStr(list, key) {
  var reverse = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  list.sort(function (a, b) {
    var valueA = key ? a[key] : a;
    var valueB = key ? b[key] : b;
    if (reverse) {
      return valueB.localeCompare(valueA);
    }
    return valueA.localeCompare(valueB);
  });
}

exports.sortByStr = sortByStr;
