"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sortAscObjectItem = sortAscObjectItem;

var _get = _interopRequireDefault(require("lodash/get"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function sortAscObjectItem(arr, field) {
  function compare(path) {
    return function (a, b) {
      var value1 = path ? (0, _get["default"])(a, path) : a;
      var value2 = path ? (0, _get["default"])(b, path) : b;
      return value1 - value2;
    };
  }

  return arr.sort(compare(field));
}