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

exotype

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exotype - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

test/value.js

6

example/duck.js
var exotype = require('../index.js')
var Duck = function (age) {
var Duck = exotype(function (age) {
this._age = age
}
})

@@ -15,2 +15,2 @@ Duck.prototype.quack = function (cb) {

module.exports = exotype(Duck)
module.exports = Duck
'use strict'
var exoform = require('exoform')
var inherits = require('inherits')
var async = require('async')

@@ -66,3 +67,3 @@ try {

var escapeString = function (string) {
return '\.' + string.replace('\'', '\\\'') + '\''
return '\'' + string.replace('\'', '\\\'') + '\''
}

@@ -114,8 +115,13 @@

var keys = Object.keys(args)
var str = '{'
for (var i = 0; i < keys.length; i++) {
str += escapeString(value) + ':' + args[keys[i]] + ','
}
if (keys.length) str = str.substr(0, str.length - 1)
cb(null, str + '}')
async.map(keys, function (key, mcb) {
transform(key, selfName, mcb)
}, function (err, transformedKeys) {
if (err) return cb(err)
var str = '{'
for (var i = 0; i < keys.length; i++) {
str += transformedKeys[i] + ':' + args[keys[i]] + ','
}
if (keys.length) str = str.substr(0, str.length - 1)
cb(null, str + '}')
})
}

@@ -198,3 +204,3 @@ }

consModule: consModule,
methods: Object.keys(type.prototype),
methods: Object.keys(Exo.prototype),
name: type.name }

@@ -201,0 +207,0 @@ })

{
"name": "exotype",
"version": "1.0.1",
"version": "2.0.0",
"description": "Persistent javascript objects.",

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

@@ -25,5 +25,5 @@ # Exotype

var Duck = function (age) {
var Duck = exotype(function (age) {
this._age = age
}
})

@@ -38,3 +38,3 @@ Duck.prototype.quack = function (cb) {

module.exports = exotype(Duck)
module.exports = Duck
```

@@ -41,0 +41,0 @@

var exotype = require('../index.js')
var a = require('async')
var Duck = function (age, children) {
var Duck = exotype(function (age, children) {
this._age = age

@@ -12,3 +12,3 @@ this.children = children || []

this.meta = { ageSum: sum }
}
})

@@ -45,2 +45,2 @@ Duck.prototype.age = function (cb) {

module.exports = exotype(Duck)
module.exports = Duck
var exotype = require('../index.js')
var RubberDuck = function (age) {
var RubberDuck = exotype(function (age) {
this.meta = { ageSum: age }
}
})

@@ -23,2 +23,2 @@ RubberDuck.prototype.age = function (cb) {

module.exports = exotype(RubberDuck)
module.exports = RubberDuck

@@ -8,2 +8,3 @@ var test = require('tape')

var Sorter = require('./sorter.js')
var Value = require('./value.js')

@@ -74,2 +75,14 @@ var persistGetback = function (obj, cb) {

test('complex args', function (t) {
var v = new Value({ 'wong': [3, 2, 0],
0: 1,
'he-lo': 9.99,
NaN: undefined })
persistGetback(v, function (res) {
t.deepEqual(v.val, res.val)
t.end()
})
})
test('functions as constructor args', function (t) {

@@ -76,0 +89,0 @@ var jumble = [3, 8, 4, 2, 2, 9, 100, 99]

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