-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.js
More file actions
102 lines (94 loc) · 3.07 KB
/
index.js
File metadata and controls
102 lines (94 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
"use strict";
const {
hello,
helloAsync,
helloPromise,
HelloObject,
HelloObjectAsync
} = require('./binding/module.node');
module.exports = {
/**
* This is a synchronous standalone function that logs a string.
* @name hello
* @returns {string}
* @example
* const { hello } = require('@mapbox/node-cpp-skel');
* const check = hello();
* console.log(check); // => "hello world"
*/
hello,
/**
* This is an asynchronous standalone function that logs a string.
* @name helloAsync
* @param {Object} args - different ways to alter the string
* @param {boolean} args.louder - adds exclamation points to the string
* @param {boolean} args.buffer - returns value as a node buffer rather than a string
* @param {Function} callback - from whence the hello comes, returns a string
* @returns {string}
* @example
* 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!!!!"
* });
*/
helloAsync,
/**
* This is a function that returns a promise. It multiplies a string N times.
* @name helloPromise
* @param {Object} [options] - different ways to alter the string
* @param {string} [options.phrase=hello] - the string to multiply
* @param {Number} [options.multiply=1] - duplicate the string this number of times
* @returns {Promise}
* @example
* const { helloPromise } = require('@mapbox/node-cpp-skel');
* const result = await helloAsync({ phrase: 'Howdy', multiply: 3 });
* console.log(result); // HowdyHowdyHowdy
*/
helloPromise,
/**
* Synchronous class, called HelloObject
* @class HelloObject
* @example
* const { HelloObject } = require('@mapbox/node-cpp-skel');
* const Obj = new HelloObject('greg');
*/
/**
* Say hello
*
* @name hello
* @memberof HelloObject
* @returns {String}
* @example
* const x = Obj.hello();
* console.log(x); // => '...initialized an object...hello greg'
*/
HelloObject,
/**
* Asynchronous class, called HelloObjectAsync
* @class HelloObjectAsync
* @example
* const { HelloObjectAsync } = require('@mapbox/node-cpp-skel');
* const Obj = new module.HelloObjectAsync('greg');
*/
/**
* Say hello while doing expensive work in threads
*
* @name helloAsync
* @memberof HelloObjectAsync
* @param {Object} args - different ways to alter the string
* @param {boolean} args.louder - adds exclamation points to the string
* @param {buffer} args.buffer - returns object as a node buffer rather then string
* @param {Function} callback - from whence the hello comes, returns a string
* @returns {String}
* @example
* 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!!!'
* });
*/
HelloObjectAsync
};