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

gwt

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gwt - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

127

gwt/lib/index.js
// Generated by CoffeeScript 1.9.1
(function() {
var Q, _, assert, buildDescription, describeScenario, getCounts, interpolate,
var I, Q, _, assert, buildDescription, deepPromiseResolve, describeScenario, getCounts, interpolate,
slice = [].slice;

@@ -12,2 +12,4 @@

I = require('immutable');
exports.result = function() {

@@ -35,6 +37,12 @@ var deferredBuilder;

exports.combine = function(leftRunner, rightRunner) {
exports.combine = function() {
var leftRunner, rest, rightRunner, runner;
leftRunner = arguments[0], rightRunner = arguments[1], rest = 3 <= arguments.length ? slice.call(arguments, 2) : [];
assert(leftRunner, 'left runner not defined');
assert(rightRunner, 'right runner not defined');
return leftRunner.combine(rightRunner);
runner = leftRunner.combine(rightRunner);
if (rest.length) {
return exports.combine.apply(exports, [runner].concat(slice.call(rest)));
}
return runner;
};

@@ -186,4 +194,53 @@

deepPromiseResolve = function(object) {
return Q(object).then(function(object) {
var deferred, fn1, fn2, i, key, promise, ref, value;
if (!object) {
return;
}
if (typeof object !== 'object') {
return object;
}
if (object instanceof Date) {
return object;
}
if (object instanceof RegExp) {
return object;
}
deferred = Q.defer();
promise = deferred.promise;
if (Array.isArray(object)) {
fn1 = function(key, value) {
return promise = promise.then(function() {
return deepPromiseResolve(value).then(function(innerValue) {
return object[key] = innerValue;
});
});
};
for (key = i = 0, ref = object.length; 0 <= ref ? i < ref : i > ref; key = 0 <= ref ? ++i : --i) {
fn1(key, object[key]);
}
} else {
fn2 = function(key, value) {
return promise = promise.then(function() {
return deepPromiseResolve(value).then(function(innerValue) {
return object[key] = innerValue;
});
});
};
for (key in object) {
value = object[key];
fn2(key, value);
}
}
promise = promise.then(function() {
return object;
});
deferred.resolve();
return promise;
});
};
describeScenario = function(spec, arg) {
var DONE, GIVEN, THEN, WHEN, bdd, counts, deferred, deferredBuilder, getGiven, getThen, getWhen, getter, only;
var DONE, GIVEN, THEN, WHEN, bdd, counts, getGiven, getThen, getWhen, getter, only, promiseBuilderFactory;
only = arg.only, counts = arg.counts;

@@ -202,6 +259,8 @@ GIVEN = spec.GIVEN, WHEN = spec.WHEN, THEN = spec.THEN, DONE = spec.DONE;

newContext.updateContext();
return Q(fn.apply(newContext, args)).then(function(result) {
newContext._last_result = result;
counts[name].called(description);
return newContext;
return deepPromiseResolve(args).then(function(args) {
return Q(fn.apply(newContext, args)).then(function(result) {
newContext._last_result = result;
counts[name].called(description);
return newContext;
});
});

@@ -214,10 +273,25 @@ };

getThen = getter('THEN', THEN);
deferred = Q.defer();
deferredBuilder = {
promiseBuilder: deferred.promise,
resolve: function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return deferred.resolve.apply(deferred, args);
}
promiseBuilderFactory = function(arg1) {
var chain;
chain = (arg1 != null ? arg1 : {
chain: I.List()
}).chain;
return {
then: function(fn) {
return promiseBuilderFactory({
chain: chain.push(fn)
});
},
resolve: function() {
var args, deferred, promise;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
deferred = Q.defer();
deferred.resolve.apply(deferred, args);
promise = deferred.promise;
chain.forEach(function(thenFn) {
return promise = promise.then(thenFn);
});
return promise;
}
};
};

@@ -227,3 +301,2 @@ bdd = function(descriptionBuilder, promiseBuilder) {

return {
deferredBuilder: deferredBuilder,
promiseBuilder: promiseBuilder,

@@ -233,3 +306,2 @@ resultTo: function(result) {

return bdd(descriptionBuilder, promiseBuilder.then(function(context) {
console.log('resolve', context._last_result);
result.resolve(context._last_result);

@@ -270,4 +342,5 @@ return context;

combine: function(rightBdd) {
var nextPromiseBuilder;
assert(rightBdd, 'right bdd not defined');
promiseBuilder.then(function(context) {
nextPromiseBuilder = promiseBuilder.then(function(context) {
var currentContext, updateContext;

@@ -278,3 +351,3 @@ currentContext = null;

};
return rightBdd.deferredBuilder.resolve({
return rightBdd.promiseBuilder.resolve({
getContext: (function() {

@@ -286,3 +359,3 @@ return currentContext;

});
return bdd(descriptionBuilder, rightBdd.promiseBuilder);
return bdd(descriptionBuilder, nextPromiseBuilder);
},

@@ -304,8 +377,2 @@ done: function(arg1) {

};
promiseBuilder.then((function() {
return done();
}), (function(err) {
console.error(err.stack);
return done(err);
}));
currentContext = null;

@@ -315,3 +382,3 @@ updateContext = function() {

};
return deferredBuilder.resolve({
return promiseBuilder.resolve({
getContext: (function() {

@@ -321,3 +388,3 @@ return currentContext;

updateContext: updateContext
});
}).then(finish).fail(done);
});

@@ -327,3 +394,3 @@ }

};
return bdd(buildDescription(), deferredBuilder.promiseBuilder);
return bdd(buildDescription(), promiseBuilderFactory());
};

@@ -330,0 +397,0 @@

{
"name": "gwt",
"version": "0.0.2",
"version": "0.0.3",
"description": "Given, when, then",
"main": "lib/index.js",
"scripts": {
"test": "make test"
"test": "make test",
"test-watch": "make test-watch"
},

@@ -16,8 +17,7 @@ "repository": {

"dependencies": {
"lodash": "^3.5.0"
},
"dependencies": {
"q": ">=1.0.1",
"async": ">=0.2.9",
"cbw": "0.0.1",
"async": ">=0.2.9"
"immutable": "^3.7.0",
"lodash": "^3.5.0",
"q": ">=1.0.1"
},

@@ -24,0 +24,0 @@ "devDependencies": {

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