This is a synchronous standalone function that logs a string.
const { hello } = require('@mapbox/node-cpp-skel');
const check = hello();
console.log(check); // => "hello world"
Returns string
This is an asynchronous standalone function that logs a string.
-
args
Object different ways to alter the string -
callback
Function from whence the hello comes, returns a string
const { helloAsync } = require('@mapbox/node-cpp-skel');
helloAsync({ louder: true }, function(err, result) {
if (err) throw err;
console.log(result); // => "...threads are busy async bees...hello
world!!!!"
});
Returns string
This is a function that returns a promise. It multiplies a string N times.
-
options
Object? different ways to alter the string
const { helloPromise } = require('@mapbox/node-cpp-skel');
const result = await helloAsync({ phrase: 'Howdy', multiply: 3 });
console.log(result); // HowdyHowdyHowdy
Returns Promise
Synchronous class, called HelloObject
const { HelloObject } = require('@mapbox/node-cpp-skel');
const Obj = new HelloObject('greg');
Say hello
const x = Obj.hello();
console.log(x); // => '...initialized an object...hello greg'
Returns String
Asynchronous class, called HelloObjectAsync
const { HelloObjectAsync } = require('@mapbox/node-cpp-skel');
const Obj = new module.HelloObjectAsync('greg');
Say hello while doing expensive work in threads
-
args
Object different ways to alter the string -
callback
Function from whence the hello comes, returns a string
const { HelloObjectAsync } = require('@mapbox/node-cpp-skel');
const Obj = new HelloObjectAsync('greg');
Obj.helloAsync({ louder: true }, function(err, result) {
if (err) throw err;
console.log(result); // => '...threads are busy async bees...hello greg!!!'
});
Returns String