Skip to content

Qix-/node-find-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-find-api Travis-CI.org Build Status Coveralls.io Coverage Rating

Finds all of the API calls and docs in a source file

This package is a highly-specialized, glorified regex engine that finds all API calls in a file.

For most languages, the documentation comment block starts with a double-star block comment (e.g. /**), though languages that do not have these style of comments will require looking up the proper format in langs.js.

Example

var findAPI = require('find-api');
var fs = require('fs');

var testJs = fs.readFileSync('./test.js').toString();
var testC = fs.readFileSync('./test.c').toString();

var jsAPIs = findAPI(testJs, 'js');
var cAPIs = findAPI(testC, 'c');

/*
	test.js:

	[
		{ doc: "This is a documented function.",
		  api: "var bar = function (a, b, c);"
		}
	]

	test.c:

	[
		{ doc: "Documented function.",
		  api: "struct some_struct_t *some_func(void);"
		}
	]
*/

test.js

/**
 * This is a documented function.
 */
var bar = function (a, b, c) {
	return a + b + c;
};

test.c

/**
	Documented function.
 */
struct some_struct_t *
some_func(void) {
	return malloc(sizeof(some_struct_t));
}

License

Licensed under the MIT License. You can find a copy of it in LICENSE.

About

Finds all of the API calls and docs in a source file

Resources

License

Stars

Watchers

Forks

Packages

No packages published