Socket
Socket
Sign inDemoInstall

warehouse

Package Overview
Dependencies
14
Maintainers
8
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    warehouse

Simple JSON-based database


Version published
Weekly downloads
16K
decreased by-0.89%
Maintainers
8
Install size
1.17 MB
Created
Weekly downloads
 

Readme

Source

Warehouse

Tester Pages Deployer NPM version Coverage Status

A JSON database with Models, Schemas, and a flexible querying interface. It powers the wildly successful static site generator Hexo.

Installation

$ npm install warehouse

3.0 BREAKING CHANGE

In warehouse@3, the constructor has been changed from function declaration to class declaration or definition by class expression. Derived classes of classes defined by class declarations and class expressions must also be defined in class declaration, class expression. Anyone who created their own SchemaType will need to change.

const SchemaType = require('warehouse/schematype');

class MySchemaType extends SchemaType {
  constructor(name, options = {}) {
    super(name, Object.assign({ foo: 'foo' }, options));
  }
}

It changes to a class declaration or a class expression, but it does not need to deal with other than the definition of the constructor.

// It work!

MySchemaType.prototype.cast = function (value, data) {
  let result = SchemaType.prototype.cast.call(this, value, data);
  return result ? result : '';
}

Usage

var Database = require('warehouse');
var db = new Database();

var Post = db.model('posts', {
  title: String,
  created: {type: Date, default: Date.now}
});

Post.insert({
  title: 'Hello world'
}).then(function(post){
  console.log(post);
});

Test

$ npm test

Keywords

FAQs

Last updated on 14 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc