Skip to content

Commit

Permalink
fix: remove hard dependency on model-fragments (#468)
Browse files Browse the repository at this point in the history
* fix: remove hard dependency on model-fragments

* fix: instanceof Fragment and FragmentArray is not an object

Co-authored-by: Gabriel Cousin <7649529+GabrielCousin@users.noreply.github.com>
  • Loading branch information
2 people authored and patocallaghan committed Oct 21, 2022
1 parent e82fd54 commit ec9f649
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions addon/converter/fixture-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ import { entries } from '../utils/helper-functions';
import { typeOf } from '@ember/utils';
import { getOwner } from '@ember/application';
import { camelize } from '@ember/string';
import require from 'require';

let Fragment;
let FragmentArray;
try {
let MF = require('ember-data-model-fragments/fragment');
let MFA = require('ember-data-model-fragments/array/fragment');
Fragment = MF && MF.default;
FragmentArray = MFA && MFA.default;
} catch (e) {
// create empty constructors
Fragment = function Fragment() {};
FragmentArray = function FragmentArray() {};
}

/**
Base class for converting the base fixture that factory guy creates to
Expand Down

0 comments on commit ec9f649

Please sign in to comment.