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

larvituser

Package Overview
Dependencies
Maintainers
1
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvituser - npm Package Compare versions

Comparing version 0.0.1-beta to 0.0.2-beta

37

larvituser.js

@@ -42,3 +42,2 @@ 'use strict';

exports.create = function create(username, password, fields, callback) {
log.verbose('yyyyeahh');
checkDbStructure(function() {

@@ -277,2 +276,38 @@ log.verbose('Trying to create user', {'username': username, 'fields': fields});

/**
* Get field data for a user
*
* @param int userId
* @param str fieldName
* @param func callback(err, data) - data is always an array of data (or empty array)
*/
exports.getFieldData = function getFieldData(userId, fieldName, callback) {
exports.getFieldId(fieldName, function(err, fieldId) {
if (err) {
callback(err);
return;
}
var sql = 'SELECT data FROM user_users_data WHERE user_id = ? AND field_id = ?',
dbFields = [userId, fieldId];
db.query(sql, dbFields, function(err, rows) {
if (err) {
callback(err);
return;
}
var data = [],
rowNr = 0;
while (rows[rowNr] !== undefined) {
data.push(rows[rowNr].data);
rowNr++;
}
callback(null, data);
});
});
}
/**
* Get data field id by field name

@@ -279,0 +314,0 @@ *

2

package.json

@@ -30,5 +30,5 @@ {

},
"version": "0.0.1beta",
"version": "0.0.2beta",
"readmeFilename": "README.md",
"license": "MIT"
}

@@ -171,2 +171,12 @@ 'use strict';

});
it('should get field data from any user', function(done) {
userLib.fromUsername('lilleman', function(err, user) {
userLib.getFieldData(user.id, 'foo', function(err, data) {
assert.deepEqual(data, ['bar']);
done();
});
});
});
});

@@ -173,0 +183,0 @@

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