/* global requirejs */

import _find from 'lodash/find';

function _hasEmberData() {
  let matchRegex = /^ember-data/i;
  return !!_find(Object.keys(requirejs.entries), (e) => !!e.match(matchRegex));
}

export const hasEmberData = _hasEmberData();

export function isDsModel(m) {
  return m
         && m.isModel
         && typeof m.eachRelationship === 'function';
}

/* global requirejs */

import _find from 'lodash/find';

function _hasEmberData() {
  let matchRegex = /^ember-data/i;
  return !!_find(Object.keys(requirejs.entries), (e) => !!e.match(matchRegex));
}

export const hasEmberData = _hasEmberData();

export function isDsModel(m) {
  return m && typeof m.eachRelationship === 'function';
}

Remove isModel check as it was introduced in Ember Data 2.12+
Remove isModel check as it was introduced in Ember Data 2.12+
