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

mongoose-repl

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-repl - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

run.js

50

lib-js/cli.js
// Generated by CoffeeScript 1.6.3
var argv, mongo_uri, path, repl, schemas, _ref, _ref1;
var mongo_uri, optimist, path, repl, schemas,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
path = require('path');
repl = require('./lib-js/mongoose-repl');
repl = require("" + __dirname + "/mongoose-repl");
argv = require("optimist").usage('mongoose [options] <mongo url>').options({
schemas: {
alias: '-s',
describe: 'Path to a module that exports schema definitions'
optimist = require("optimist");
module.exports = {
schemas: schemas = function(schema_path) {
if (schema_path != null) {
return require(path.resolve(schema_path));
} else {
return {};
}
},
mongo_uri: mongo_uri = function(host, db) {
if (db && __indexOf.call(db, '/') >= 0) {
if (host != null) {
throw new Error("url can't have host if you specify it using the --host option");
}
return db;
} else {
return "" + (host != null ? host : 'localhost') + "/" + (db != null ? db : 'test');
}
},
run: function() {
var argv, _ref;
argv = optimist.usage('mongoose [options] <mongo url>').options({
schemas: {
alias: '-s',
describe: 'Path to a module that exports schema definitions'
},
host: {
alias: '-h',
describe: 'Host to connect to'
}
}).argv;
return repl.run(schemas(argv.s), mongo_uri(argv.h, (_ref = argv._) != null ? _ref[0] : void 0));
}
}).argv;
schemas = argv.s != null ? require(path.resolve(argv.s)) : {};
mongo_uri = (_ref = (_ref1 = argv._) != null ? _ref1[0] : void 0) != null ? _ref : 'localhost';
repl.run(schemas, mongo_uri);
};
// Generated by CoffeeScript 1.6.3
var CoffeeScript, format_error, inspect, magic_cb, mongoose, node_repl, util, vm, writer, _,
var CoffeeScript, format_error, inspect, mongoose, node_repl, util, vm, writer, _,
__slice = [].slice;

@@ -48,18 +48,2 @@

magic_cb = function(context) {
return function() {
var err, other, res;
err = arguments[0], res = arguments[1], other = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
if (err != null) {
return console.error(err);
} else {
console.log(writer(res));
context._ = res;
if (!_.isEmpty(other)) {
return console.log('other cb args:', _.map.apply(_, __slice.call(other).concat([writer])));
}
}
};
};
module.exports.run = function(schemas, mongo_uri) {

@@ -110,4 +94,3 @@ var conn, models, options;

return console.log(_.map(val, inspect).join(', '));
},
magic: magic_cb(repl.context)
}
});

@@ -114,0 +97,0 @@ return repl.on('exit', function() {

{
"name": "mongoose-repl",
"version": "0.0.4",
"version": "0.1.0",
"description": "A Mongo REPL with the full power of Mongoose",

@@ -10,3 +10,3 @@ "engines": {

"bin": {
"mongoose": "./cli.js"
"mongoose": "./run.js"
},

@@ -22,3 +22,6 @@ "scripts": {

"underscore": "~1.5.1"
},
"devDependencies": {
"mocha": "~1.12.0"
}
}

Sorry, the diff of this file is not supported yet

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc