New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vine

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vine - npm Package Compare versions

Comparing version 0.0.1 to 0.0.5

vine/MIT-LICENSE.txt

6

vine/._index.js

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

Mac OS X  2��ATTR(/��!�!com.macromates.caret{
column = 0;
line = 1;
Mac OS X  2��ATTR(/��"�"com.macromates.caret{
column = 5;
line = 86;
}

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

Mac OS X  2y�ATTR(����com.apple.TextEncodingutf-8;134217984
Mac OS X  2y�ATTRCt����com.apple.TextEncodingutf-8;134217984

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

Mac OS X  2��ATTR(���!�!com.macromates.caret{
Mac OS X  2��ATTR(���"�"com.macromates.caret{
column = 0;
line = 4;
line = 12;
}

@@ -35,3 +35,7 @@ //meh, shit's ugly.

{
setApi:function(request)
/**
*/
setApi: function(request)
{

@@ -42,3 +46,7 @@ request.api = Vine.api(request);

},
api:function(request,methods,data)
/**
*/
api: function(request,methods,data)
{

@@ -52,3 +60,7 @@ if(!data) data = {};

{
error:function()
/**
*/
error: function()
{

@@ -61,5 +73,18 @@ if(arguments.length == 0) return data.errors;

return this;
}
,warning:function()
},
/**
* the type of data. Used for
*/
type: function(type)
{
data.type = type;
},
/**
*/
warning: function()
{
if(arguments.length == 0) return data.warnings;

@@ -71,7 +96,11 @@

return this;
}
,combine:function(api)
},
/**
*/
combine: function(api)
{
var thisData = data,
thatData = api.data,
thatData = api.data || api,
newData = {};

@@ -85,5 +114,10 @@

return Coco.api(null,null,newData);
}
,redirect:function(to)
return Vine.api(null,null,newData);
},
/**
*/
redirect: function(to)
{

@@ -94,4 +128,8 @@ if(to == undefined) return data.redirect;

return this;
}
,message:function(msg)
},
/**
*/
message: function(msg)
{

@@ -102,4 +140,8 @@ if(!msg) return data.message;

return this;
}
,result:function(result)
},
/**
*/
result: function(result)
{

@@ -110,4 +152,8 @@ if(result == undefined) return data.result;

return this;
}
,results:function(result)
},
/**
*/
results: function(result)
{

@@ -119,4 +165,8 @@ if(result == undefined) return data.result;

return this;
}
,ttl:function(ttl)
},
/**
*/
ttl:function(ttl)
{

@@ -127,12 +177,31 @@ if(ttl > -1)

return this;
}
,send:function(r,displayType)
},
/**
* deprecated
*/
send: function(request)
{
request.display('json',data);
},
/**
*/
end: function(target)
{
if(!r || (typeof r == 'string'))
displayType = r;
else
request = r;
if(target) target.end(data);
request.display(displayType || 'json',data);
return data;
},
/**
*/
toJSON: function()
{
return invoker.data;
}

@@ -161,1 +230,3 @@ }

});
{
"name": "vine",
"description": "API builder",
"version": "0.0.1",
"version": "0.0.5",
"author": "Craig Condon",

@@ -6,0 +6,0 @@ "repository": {

Vine - JSON Message builder
============================
What's this?
------------
Just a small utility to help build consistent JSON messages, usually for API's.
Why?
----
Consistency. It's also cleaner, and easier to maintain.
Where should I use this?
------------------------
- API
- nice replacement for callback(err, result);
Code Usage:
-----------
```javascript
var vine = require('vine');
var data = vine.message('hello %s %s','craig','condon').
error('this is an error').
warning('this is a warning').
//time to cache this response
ttl(5).
//result data = success
result({data:'and this is some data'});
console.log(data.data);
/* output:
{ message: 'hello craig condon',
errors: [ { message: 'this is an error' } ],
warnings: [ { message: 'this is a warning' } ],
ttl: 5,
result: { data: 'and this is some data' } }
*/
```
To Do:
------
- code != clean
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc