New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hyprmodel

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

hyprmodel

small model on top of hyperdb

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

hyprmodel

Simple model on top of hyperdb A model is saved as a single hyperdb key with this pattern: /{model_name}.json. Adding a new item to the model will replace this key with the updated structure. Using the same id or name will update included keys and leave the original keys intact (uses Object.assign).

Example


var hyperdb   = require ('hyperdb')
var hyprmodel = require('hyprmodel')
var crypto    = require('crypto')
var http      = require('http')

var db        = new hyperdb ('example.db', { valueEncoding: 'utf-8' })
var m         = hyprmodel (db, 'turnips')

// create hyperdb key: /turnips.json

m.add({
  id: crypto.randomBytes(11).toString('hex'),
  name: Math.random()
})

http.createServer(function (req, res) {
  res.setHeader('Content-Type', 'application/json')
  if (!req.url.startsWith('/api/turnips')) return res.end('no dice.')
  m.get(function (e, i) {
    if (!e) res.end(i)
      else res.end('@')
  })
}).listen(8000)

Install

npm install hyprmodel --save

Keywords

hyperdb

FAQs

Package last updated on 12 Nov 2017

Did you know?

Socket

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