janhommes / o.js

o.js - client side oData lib.

Home Page:https://janhommes.github.io/o.js/example/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node example incorrect

phmasek opened this issue · comments

Documentation says the following:

const o = require('odata');

// promise example
o('http://my.url')
  .get('resource')
  .then((data) => console.log(data));

however I receive an error copying the code:
TypeError: o is not a function

To get it to work I had to do the following:

const o = require('odata').o;

// promise example
o('http://my.url')
  .get('resource')
  .then((data) => console.log(data));

yes, you are right. We need to update the docs as well with the input in #96

Maybe like this:

const { o } = require('odata');

// promise example
o('http://my.url')
  .get('resource')
  .then((data) => console.log(data));

object destruction should work in the latest node versions, or?