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

xylem

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xylem - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

34

example/basic.js
var Server = require('../');
var Memory = require('../lib/memory');
// Create server,
// Create server.
var server = new Server();

@@ -23,20 +23,22 @@

// Get 'contact' model.
var Contact = server.model('contact');
server.init(function() {
// Get 'contact' model.
var Contact = server.model('contact');
// Create 'john' contact instance.
var john = new Contact({
id: 1,
name: 'John',
email: 'john@example.com'
});
// Create 'john' contact instance.
var john = new Contact({
id: 1,
name: 'John',
email: 'john@example.com'
});
// Save contact.
john.save(function (error, john) {
console.log(john);
// Save contact.
john.save(function (error, john) {
console.log(john);
// Get a list of contacts.
Contact.list({}, function (error, contacts) {
console.log(contacts);
})
// Get a list of contacts.
Contact.list({}, function (error, contacts) {
console.log(contacts);
});
});
});

@@ -84,2 +84,5 @@ var url = require('url');

// Add name to model settings.
settings.name = name;
this.storage.model(name, Model.compile(connection, settings));

@@ -103,3 +106,3 @@

port: 'port',
path: 'pathname'
database: 'pathname'
};

@@ -116,2 +119,7 @@

if (property == 'pathname') {
// Remove slash from pathname.
value = value.substring(1, value.length);
}
if (property in urlInfo) {

@@ -118,0 +126,0 @@ settings[setting] = value;

@@ -21,2 +21,9 @@ /*

/**
* Initialize database connection.
*/
MemoryAdapter.prototype.init = function(callback) {
callback();
};
/**
* List stored items.

@@ -23,0 +30,0 @@ *

{
"name": "xylem",
"version": "0.0.1",
"version": "0.0.2",
"description": "Cross database object persistence for Node.js.",

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

@@ -11,11 +11,7 @@ # Xylem

```
npm install xylem
```
$ npm install xylem
### Installing an adapter
```
npm install xylem-mongodb
```
$ npm install xylem-mongodb

@@ -25,5 +21,7 @@ ### Creating connections

```js
var server = require('xylem');
var Server = require('xylem');
var MongoDB = require('xylem-mongodb');
var server = new Server();
server

@@ -65,3 +63,3 @@ .adapter('mongodb', MongoDB)

console.log(contacts);
})
});
});

@@ -75,3 +73,3 @@ ```

- Memory (Built in)
- MongoDB
- [MongoDB](https://github.com/recidive/xylem-mongodb)

@@ -78,0 +76,0 @@ ## Lifecycle callbacks

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