const ns = require ('ns-api') ({
  username: 'api-username',
  password: 'api-password'
});

// Travel parameters
const params = {
  fromStation: 'Amersfoort',
  toStation: 'Den Haag'
};

// console.log does not log >3 levels
function myCallback (err, data) {
  console.dir (err || data, {
    depth: null,
    colors: true
  });
}

// Get travel advise
ns.reisadvies (params, myCallback);

@@ -1,16 +1,19 @@
 const 
-ns
+NSAPI
  = requi
@@ -29,164 +29,53 @@
 pi')
- (%7B%0A  username: 'api-username',%0A  password: 'api-password'%0A%7D);%0A%0A// Travel parameters%0Aconst params = %7B%0A  fromStation: 'Amersfoort',%0A  toStation: 'Den Haag'
+;%0Aconst ns = new NSAPI (%7B%0A  key: 'abc123',
 %0A%7D
+)
 ;%0A%0A/
@@ -124,25 +124,16 @@
 ion 
-myCallback (err, 
+output (
 data
@@ -155,15 +155,8 @@
 ir (
-err %7C%7C 
 data
@@ -192,16 +192,17 @@
 rs: true
+,
 %0A  %7D);%0A%7D
@@ -210,58 +210,180 @@
 %0A// 
-Get travel advise%0Ans.reisadvies (params, myCallback)
+Travel parameters%0Aconst params = %7B%0A  fromStation: 'Amersfoort',%0A  toStation: 'Den Haag',%0A%7D;%0A%0A// Get travel advise%0Ans.trips (params)%0A  .then (output)%0A  .catch (console.error)%0A
 ;%0A

Rewrite to v3 interface