Socket
Socket
Sign inDemoInstall

bees

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

lib/plugin/descr.js

2

index.js

@@ -1,1 +0,1 @@

module.exports = require('./lib/bees');
module.exports = require('./lib/bees.js');

@@ -0,49 +1,55 @@

var fs = require('fs'),
bees = exports;
var plugins = {
"return": require('./plugins/return'),
"param" : require('./plugins/param')
'@param': require('./plugin/param'),
'@path' : require('./plugin/path'),
'@descr': require('./plugin/descr')
};
exports.parse = function bees(file) {
var matches = file.match(/\/\*{1,2}(.|\n)+?\*\//g),
json = [];
matches.map(function(m) {
bees.load = function(file) {
return fs.readFileSync(file, 'utf-8');
};
bees.parse = function(file) {
var blocks = file.match(/\/\* @api[\w\W*]+?\*\//g) || [],
config = [];
blocks.forEach(function(api) {
var path = {};
api = api.split('\n');
api.shift();
api.pop();
api = api.map(function(x) {
var match = x.match(/@([\w\W]+?;)/) || [];
return match.shift() || "";
});
var sub = {};
m = m.split('\n');
m.pop();
m.shift();
m.map(function(i) {
(function every(list) {
var item = list.shift();
if(!item) return;
i = i.replace(/\*/g, '')
.trim();
if(!i.length) return;
if(~i.indexOf('@')) {
var cmd = i.match(/@(\w+)\s([\W\w]+)?/);
cmd.shift();
if(plugins[cmd[0]]) {
plugins[cmd[0]](cmd, sub);
}
item = item.replace(/[.*\n]/g, '').split(' ');
var cmd = item.shift();
if(plugins[cmd]) {
plugins[cmd](path, item);
}
else {
i = i.split(' ');
sub.method = i[0];
sub.path = i[1];
}
});
every(list);
})(api.join('\n').split(';'));
json.push(sub);
config.push(path);
});
return json;
return config;
};
exports.use = function(name, fn) {
bees.use = function(name, fn) {
plugins[name] = fn;
};
}
{
"name": "bees",
"version": "0.0.4",
"version": "0.0.5",
"author": "yawnt <yawn.localhost@gmail.com>",
"description": "HTTP API Generator",
"description": "Api documentation generator",
"devDependencies": {
"vows": ">= 0.0.0"
"mocha": ">= 0.0.0",
"should": ">= 0.0.0",
"assert": ">= 0.0.0"
},
"scripts": {
"test": "vows --spec --isolate test/test-*.js"
"test": "mocha -R spec -r should test/*-test.js"
},

@@ -19,2 +21,2 @@ "bin": {

}
}
}

@@ -77,3 +77,2 @@ bees (in Italian ```API``` means ```bees```)

);
```

@@ -95,6 +94,39 @@

$ node plugin.js
[
{
method: 'GET',
path: '/:id',
params: { id: 'id of the user' },
return: 'user infos',
plugin: 'hai lol'
}
]
```
## Reporters:
Reporters are a way to return formatted objects.
If we got this in eyes-reporter.js:
```javascript
var inspector = require('eyes').inspector({stream: null});
module.exports = function(doc) {
return inspector(doc);
};
```
And we call bees just like this:
```
bees -R eyes-reporter <file>
```
We will get:
![eyes](http://i.imgur.com/F9p5M.png)
Cool eh?
## To Do:

@@ -101,0 +133,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc