0

I have a source module:

import _ from 'underscore'
import {Observable} from 'rxjs'

export default function (rxfb) {
  return {
    getProperties () {
      return rxfb.sources.user.getUser()
        .switchMap(({properties}) =>
          properties
            ? Observable.combineLatest(_(properties).map((property, propertyId) =>
              this.getProperty(propertyId).map(property => ({propertyId, ...property}))))
            : Observable.from([{}]))
    }
  }
}

I need to access it from another section so I am importing it:

import myProperties from '../../sources/properties'

Then I try:

console.log(myProperties.getProperties())

but it does not work, what is the proper way to get access to this method?

Nimeshka Srimal
  • 8,012
  • 5
  • 42
  • 57
Eduardo
  • 1,781
  • 3
  • 26
  • 61

1 Answers1

1

You are exporting a function BUT you are using it like an Object!

It seems that you have to use it like this (calling the function):

import myProperties from '../../sources/properties'
console.log(myProperties().getProperties())
Mahdi Aryayi
  • 1,090
  • 7
  • 13