🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

firearm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firearm - npm Package Compare versions

Comparing version
0.0.1
to
0.0.11
+34
-28
build/index.js
'use strict'
class Firearm {
constructor(gun, opts) {
constructor({gun, Gun, opts}) {
this.gun = gun
this.Gun = (typeof window !== 'undefined') ? window.Gun : require('gun/gun')
// If we don't pass gun instance, then see if it's available from window or file - use Firearm's args to create a new gun instance.
/*const hasGun = (gun && gun.chain) ? true : false
if (!hasGun)
this.gun = this.Gun(...arguments)
*/
this._ctx = null
this._ctxVal = null
this._ready = true
this._proxyEnable = true
// Immutability is an opt-in feature. use: new Firearm(gun, { immutable: true })
this.immutable = (opts && opts.immutable) ? true : false
const that = this
this.Gun.on('opt', function(context) {
that._registerContext = context
this.to.next(context)
})
this.gun = this.Gun(...arguments)
this.mutate = this.mutate.bind(this)
this.extend = this.extend.bind(this)
return new Proxy(this.gun, firearmProxy(this))
this.Gun = (typeof window !== 'undefined') ? window.Gun : Gun
if(!Gun){
let err = {
err: 'no gun class supplied'
}
return err
} else {
// If we don't pass gun instance, then see if it's available from window or file - use Firearm's args to create a new gun instance.
/*const hasGun = (gun && gun.chain) ? true : false
if (!hasGun)
this.gun = this.Gun(...arguments)
*/
this._ctx = null
this._ctxVal = null
this._ready = true
this._proxyEnable = true
// Immutability is an opt-in feature. use: new Firearm(gun, { immutable: true })
this.immutable = (opts && opts.immutable) ? true : false
const that = this
this.Gun.on('opt', function(context) {
that._registerContext = context
this.to.next(context)
})
this.gun = this.Gun(...arguments)
this.mutate = this.mutate.bind(this)
this.extend = this.extend.bind(this)
return new Proxy(this.gun, firearmProxy(this))
}
}

@@ -34,0 +40,0 @@

{
"name": "firearm",
"version": "0.0.1",
"version": "0.0.11",
"description": "Wrapper around [GunDB](https://github.com/amark/gun) to provide alternative syntax, promise support, utility modules, and easy Gun adapter events.",

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