@@ -4,6 +4,8 @@ import { isHTMLSafe } from '@ember/template';
44import EmberObject from '@ember/object' ;
55import { typeOf } from '@ember/utils' ;
66import { A as emberArray } from '@ember/array' ;
7+
8+ // ember-data feature detection
79import require from 'require' ;
810
911function requireModule ( module , exportName = 'default' ) {
@@ -14,7 +16,21 @@ function requireModule(module, exportName = 'default') {
1416
1517const DS = requireModule ( 'ember-data' ) ;
1618const Model = requireModule ( '@ember-data/model' ) ;
19+ const { ManyArray, PromiseManyArray } = DS ;
20+
21+ export function isDsModel ( o ) {
22+ return ! ! ( Model && o && o instanceof Model ) ;
23+ }
24+
25+ export function isDSManyArray ( o ) {
26+ return ! ! (
27+ Model &&
28+ o &&
29+ ( o instanceof PromiseManyArray || o instanceof ManyArray )
30+ ) ;
31+ }
1732
33+ // ember internals
1834export { getDependentKeys , isDescriptor } from '../-private/ember-internals' ;
1935
2036export function unwrapString ( s ) {
@@ -43,18 +59,6 @@ export function isPromise(p) {
4359 return ! ! ( p && canInvoke ( p , 'then' ) ) ;
4460}
4561
46- export function isDsModel ( o ) {
47- return ! ! ( Model && o && o instanceof Model ) ;
48- }
49-
50- export function isDSManyArray ( o ) {
51- return ! ! (
52- DS &&
53- o &&
54- ( o instanceof DS . PromiseManyArray || o instanceof DS . ManyArray )
55- ) ;
56- }
57-
5862export function isEmberObject ( o ) {
5963 return ! ! ( o && o instanceof EmberObject ) ;
6064}
0 commit comments