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

datamodel

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datamodel - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

test/assets/obj.js

13

lib/datamodel.js

@@ -134,7 +134,8 @@ 'use strict';

self._transformer(function(newresults) {
if (!output) {
fn(err, newresults);
self.results = newresults;
if (output && typeof self._sender === 'function') {
self._sender(output, fn);
}
else {
self._sender.call(self.results, output, fn);
fn(err, self.results);
}

@@ -144,7 +145,7 @@ });

else {
if (!output) {
fn(err, self.results);
if (output && typeof self._sender === 'function') {
self._sender(output, fn);
}
else {
self._sender.call(self.results, output, fn);
fn(err, self.results);
}

@@ -151,0 +152,0 @@ }

{
"name": "datamodel",
"version": "1.0.3",
"version": "1.0.4",
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",

@@ -16,3 +16,3 @@ "contributors": [],

"scripts": {
"test": "mocha"
"test": "./node_modules/.bin/istanbul test ./node_modules/.bin/_mocha -- -R spec"
},

@@ -27,3 +27,4 @@ "main": "./index.js",

"mocha": ">=1.8.1",
"should": ">=1.2.1"
"should": ">=1.2.1",
"istanbul": "^0.2.10"
},

@@ -30,0 +31,0 @@ "license": "MIT",

@@ -248,7 +248,53 @@ /* global describe, it */

);
it('14 - declare & append & complete & transform & send', function (done) {
datamodel()
.declare('a', function(input, fill) {
fill('(a)');
})
.append('b', function(input, fill) {
fill('(' + this.a + input + 'b)');
})
.complete('c', function(input, fill) {
fill('(' + this.a + input + this.b + input + 'c)');
})
.transform(function(input, fill) {
fill(
{
a: this.a.replace(/\(/g, '[').replace(/\)/g, ']'),
b: this.b.replace(/\(/g, '[').replace(/\)/g, ']'),
c: this.c.replace(/\(/g, '[').replace(/\)/g, ']')
}
);
})
.send(function(output, next) {
next(output + this.c)
})
.apply(' - ', ' ----> ', function(r) {
assert.equal(r, ' ----> [[a] - [[a] - b] - c]');
done();
}
);
}
);
it('15 - module', function (done) {
var m = require('./assets/obj.js')
m('$', 'out', function(err, res) {
assert.equal(res.a, '$A');
assert.equal(res['b.1'], '$B1');
assert.equal(res['b.2'], '$B2');
assert.equal(res['b.3'], '$B3');
assert.equal(res.c, '$C');
done();
}
);
}
);
/* */
}
)

Sorry, the diff of this file is not supported yet

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