Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accountdown-parser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accountdown-parser - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

28

index.js
var extend = require('extend')
var formBody = require('body/any')
module.exports = accountdown-parser
module.exports = Parser
function accountdown-parser (accountdown, opts) {
if (!(this instanceof accountdown-parser)) {
return new accountdown-parser(accountdown, opts)
function Parser (accountdown, opts) {
if (!(this instanceof Parser)) {
return new Parser(accountdown, opts)
}
if (!opts) opts = {};
if (!opts) opts = {}
this.accountdown = accountdown

@@ -20,12 +20,12 @@ // When updating an account, this function tells us whether the

// Formats the account request data that could not be done on the client
this.format = opts.format;
this.format = opts.format
this.parse = function(string, cb) {
var parsedBody = require('qs').parse(string)
return cb(null, parsedBody);
return cb(null, parsedBody)
}
}
accountdown-parser.prototype.create = function (req, res, cb) {
var self = this;
Parser.prototype.create = function (req, res, cb) {
var self = this

@@ -35,6 +35,6 @@ formBody(req, res, { querystring: { parse: this.parse }}, function(err, body) {

// { login: {...}, value: {key: .., ...} }
if (err) return console.log("accountdown-parser: body did not parse:", err)
if (err) return console.log("Parser: body did not parse:", err)
if (self.format) body = self.format(body)
if (!self.validate(body))
return console.log("\naccountdown-parser.create: invalid body: ", self.validate.errors)
return console.log("\nParser.create: invalid body: ", self.validate.errors)

@@ -48,4 +48,4 @@ self.accountdown.create(body.value.key, body, function (err) {

accountdown-parser.prototype.update = function (req, res, key, cb) {
var self = this;
Parser.prototype.update = function (req, res, key, cb) {
var self = this
self.accountdown.get(key, function (err, existingAccountValue) {

@@ -59,3 +59,3 @@ if (err) return console.log(err)

if (!self.validate(body))
return console.log("\naccountdown-parser.update: invalid body: ", self.validate.errors)
return console.log("\nParser.update: invalid body: ", self.validate.errors)

@@ -62,0 +62,0 @@ // Overwrite all new values in existing account, and retain any values not

{
"name": "accountdown-parser",
"version": "0.1.2",
"version": "0.1.3",
"description": "Facilitates account creation and user input validation using accountdown and json-schema",

@@ -5,0 +5,0 @@ "main": "index.js",

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