-
-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathhelper.js
More file actions
21 lines (19 loc) · 564 Bytes
/
helper.js
File metadata and controls
21 lines (19 loc) · 564 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* this is not an example. this is a helper used to generate
* the list of links to examples in the readme.
*/
const fs = require('fs');
const path = require('path');
module.exports = function() {
const files = fs.readdirSync(__dirname);
const links = [];
for (let i = 0; i < files.length; i++) {
const name = files[i];
const ext = path.extname(name);
const stem = path.basename(name, ext);
if (stem !== 'helper' && ext === '.js') {
links.push('- [' + stem + '](examples/' + name + ')');
}
}
return links.join('\n');
};