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

ampersand-sync

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-sync - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

6

ampersand-sync.js

@@ -30,3 +30,3 @@ /*$AMPERSAND_VERSION*/

if (!options.url) {
params.url = _.result(model, 'url') || urlError();
options.url = _.result(model, 'url') || urlError();
}

@@ -42,4 +42,4 @@

// make sure we've got a '?'
params.url += _.contains(params.url, '?') ? '&' : '?';
params.url += qs.stringify(options.data);
options.url += _.contains(options.url, '?') ? '&' : '?';
options.url += qs.stringify(options.data);
}

@@ -46,0 +46,0 @@

{
"name": "ampersand-sync",
"description": "Provides sync behavior for updating data from ampersand models and collections to the server.",
"version": "3.0.2",
"version": "3.0.3",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -23,8 +23,8 @@ "browserify": {

"ampersand-rest-collection": "^2.0.1",
"browserify": "^5.9.3",
"browserify": "^6.2.0",
"jshint": "^2.5.3",
"phantomjs": "^1.9.7-15",
"phantomjs": "^1.9.12",
"precommit-hook": "^1.0.7",
"run-browser": "~1.3.0",
"tap-spec": "^0.2.0",
"tap-spec": "^1.0.1",
"tape": "^2.14.0",

@@ -31,0 +31,0 @@ "tape-run": "^0.3.0"

@@ -46,2 +46,4 @@ var test = require('tape');

t.ok(!xhr.ajaxSettings.data);
var xhr2 = sync('read', getStub(), {url: '/library/books'});
t.equal(xhr2.ajaxSettings.url, '/library/books', 'passed url should overwrite model url');
t.end();

@@ -54,6 +56,10 @@ });

t.equal(xhr.ajaxSettings.url, '/library?a=a&one=1', 'data passed to reads should be made into a query string');
var otherStub = getStub();
otherStub.url = '/library?something=hi';
var xhr2 = sync('read', otherStub, {data: {a: 'a', one: 1}});
t.equal(xhr2.ajaxSettings.url, '/library?something=hi&a=a&one=1', 'data passed to reads should be made into a query string');
var modelStub = getStub();
modelStub.url = '/library?something=hi';
var xhr2 = sync('read', modelStub, {data: {a: 'a', one: 1}});
t.equal(xhr2.ajaxSettings.url, '/library?something=hi&a=a&one=1', 'data passed to reads should be appended to an existing query string in the url');
var xhr3 = sync('read', getStub(), {url: '/library/books', data: {a: 'a', one: 1}});
t.equal(xhr3.ajaxSettings.url, '/library/books?a=a&one=1', 'data passed to reads should be added as a query string to overwritten url');
t.end();

@@ -60,0 +66,0 @@ });

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