New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-q-spread

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-q-spread - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

index.js

5

bower.json
{
"name": "angular-q-spread",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://github.com/showpad/angular-q-spread",
"authors": [
"Klaas Cuvelier <cuvelierklaas@gmail.com>"
],
"description": "Add `spread` method to the promise of $q.all",

@@ -9,0 +6,0 @@ "main": "dist/q-spread.js",

4

CHANGELOG.md
# angular-q-spread changelog
### 1.0.3
* Make `spread` chainable - @mattlewis92
* Fix `main` in package.json - @tkambler
### 1.0.2

@@ -4,0 +8,0 @@ * Make spread chainable

@@ -23,3 +23,3 @@ (function (angular) {

function spread(data) {
resolve.apply(void 0, data);
return resolve.apply(void 0, data);
}

@@ -26,0 +26,0 @@

@@ -1,1 +0,1 @@

!function(n){"use strict";n.module("$q-spread",[]).config(["$provide",function(n){n.decorator("$q",["$delegate",function(n){var r=n.all;return n.all=function(n){var t=r(n);return t.spread=function(n,r){function e(r){n.apply(void 0,r)}return t.then(e,r)},t},n}])}])}(window.angular);
!function(n){"use strict";n.module("$q-spread",[]).config(["$provide",function(n){n.decorator("$q",["$delegate",function(n){var r=n.all;return n.all=function(n){var t=r(n);return t.spread=function(n,r){function e(r){return n.apply(void 0,r)}return t.then(e,r)},t},n}])}])}(window.angular);
'use strict';
var gulp = require('gulp'),
karma = require('karma').server,
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
stylish = require('jshint-stylish'),
var gulp = require('gulp');
var karma = require('karma');
var jshint = require('gulp-jshint');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var stylish = require('jshint-stylish');
config = {
var config = {
test: __dirname + '/test/karma.conf.js',

@@ -19,6 +19,11 @@ src: './src/q-spread.js',

gulp.task('karma', function (done) {
karma.start({
configFile: config.test,
singleRun: true
}, done);
var server = new karma.Server(
{
configFile: config.test,
singleRun: true
},
done
);
server.start();
});

@@ -25,0 +30,0 @@

{
"name": "angular-q-spread",
"version": "1.0.2",
"version": "1.0.3",
"description": "Add `spread` method to the promise of $q.all",

@@ -20,3 +20,2 @@ "main": "index.js",

],
"author": "Klaas Cuvelier",
"license": "MIT",

@@ -28,14 +27,14 @@ "bugs": {

"devDependencies": {
"bower": "^1.3.12",
"gulp": "^3.8.9",
"gulp-jshint": "1.6.4",
"gulp-rename": "^1.2.0",
"gulp-uglify": "^1.0.1",
"jshint-stylish": "0.2.0",
"karma": "~0.12.16",
"karma-chrome-launcher": "~0.1.4",
"karma-jasmine": "~0.2",
"karma-junit-reporter": "0.2.2",
"karma-phantomjs-launcher": "~0.1.4"
"bower": "1.4.1",
"gulp": "3.9.0",
"gulp-jshint": "1.11.2",
"gulp-rename": "1.2.2",
"gulp-uglify": "1.2.0",
"jshint-stylish": "2.0.1",
"karma": "0.13.2",
"karma-chrome-launcher": "0.2.0",
"karma-jasmine": "0.3.6",
"karma-junit-reporter": "0.3.2",
"karma-phantomjs-launcher": "0.2.0"
}
}

@@ -25,13 +25,16 @@ [![GitHub version](https://badge.fury.io/gh/showpad%2Fangular-q-spread.svg)](http://badge.fury.io/gh/showpad%2Fangular-q-spread)

function TestCtrl($scope, $q, MyService) {
$scope.data1 = null;
$scope.data2 = null;
function dataSuccess(result1, result2)
$scope.name = null;
function firstCallback(firstname, lastname)
{
$scope.data1 = result1;
$scope.data2 = result2;
return firstname + ' ' + lastname;
}
function dataFailure(reason)
function anotherCallback(fullname)
{
$scope.name = fullname;
}
function failureCallback(reason)
{
alert('Could not load data: ' + reason);

@@ -42,6 +45,8 @@ }

.all([
MyService.getData1(),
MyService.getData2()
MyService.getFirstname(),
MyService.getLastname()
])
.spread(dataSuccess, dataFailure);
.spread(firstCallback)
.then(anotherCallback)
.catch(failureCallback);
};

@@ -48,0 +53,0 @@

@@ -23,3 +23,3 @@ (function (angular) {

function spread(data) {
resolve.apply(void 0, data);
return resolve.apply(void 0, data);
}

@@ -26,0 +26,0 @@

@@ -97,3 +97,3 @@ 'use strict';

xit('should call the defer method with the reason of the failed defer on failure', function () {
it('should call the defer method with the reason of the failed defer on failure', function () {
var defer1 = new $q.defer(),

@@ -121,3 +121,28 @@ defer2 = new $q.defer();

it('should return a value which can be read by the next promise in the chain', function () {
var defer1 = new $q.defer(),
defer2 = new $q.defer();
window.spreadResult = function () {};
spyOn(window, 'spreadResult').and.callThrough();
$q
.all([
defer1.promise,
defer2.promise
])
.spread(function(result1, result2) {
return result1 + result2;
}).then(spreadResult);
defer1.resolve(1);
defer2.resolve(2);
$rootScope.$digest();
expect(spreadResult).toHaveBeenCalledWith(3);
});
});
});

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