"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = unique;
var _arrayContainsObject = _interopRequireDefault(require("./arrayContainsObject"));
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {
    default: obj
  };
}
/**
 * @flow
 */

function unique /*:: <T>*/(arr /*: Array<T>*/) /*: Array<T>*/{
  const uniques = [];
  arr.forEach(value => {
    if (value instanceof _ParseObject.default) {
      if (!(0, _arrayContainsObject.default)(uniques, value)) {
        uniques.push(value);
      }
    } else {
      if (uniques.indexOf(value) < 0) {
        uniques.push(value);
      }
    }
  });
  return uniques;
}