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

lore-actions

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lore-actions - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

test/.eslintrc

4

lib/blueprints/create.js

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

model.save().done(function () {
model.save().then(function () {
if (options.onSuccess) {

@@ -43,3 +43,3 @@ dispatch({

}
}).fail(function (response) {
}).catch(function (response) {
if (options.onError) {

@@ -46,0 +46,0 @@ var error = response.responseJSON;

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

proxyModel.destroy().done(function () {
proxyModel.destroy().then(function () {
if (options.onSuccess) {

@@ -44,3 +44,3 @@ dispatch({

}
}).fail(function (response) {
}).catch(function (response) {
if (options.onError) {

@@ -47,0 +47,0 @@ var error = response.responseJSON;

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

model.fetch().done(function () {
model.fetch().then(function () {
if (options.onSuccess) {

@@ -45,3 +45,3 @@ dispatch({

}
}).fail(function (response) {
}).catch(function (response) {
if (options.onError) {

@@ -48,0 +48,0 @@ var error = response.responseJSON;

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

data: query
}).done(function () {
}).then(function () {
if (options.onSuccess) {

@@ -48,3 +48,3 @@ dispatch({

}
}).fail(function (response) {
}).catch(function (response) {
if (options.onError) {

@@ -51,0 +51,0 @@ var error = response.responseJSON;

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

proxyModel.save().done(function () {
proxyModel.save().then(function () {
if (options.onSuccess) {

@@ -46,3 +46,3 @@ dispatch({

}
}).fail(function (response) {
}).catch(function (response) {
if (options.onError) {

@@ -49,0 +49,0 @@ var error = response.responseJSON;

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

error: error || {},
data: collection.map(function (model) {
data: collection.models.map(function (model) {
return payload(model, state, error);

@@ -55,0 +55,0 @@ })

{
"name": "lore-actions",
"version": "0.3.1",
"author": "Storcery",
"version": "0.4.0",
"license": "MIT",
"description": "Blueprints to reduce boilerplate for Redux actions",
"homepage": "https://github.com/lore/lore#readme",
"main": "lib/index.js",
"files": [
"lib",
"src"
],
"scripts": {
"clean": "rimraf lib coverage .tmp",
"lint": "eslint src test",
"test": "mocha --compilers js:babel-core/register --recursive",
"test:cov": "babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive",
"check": "npm run lint && npm run test",
"build": "babel src --out-dir lib",
"preversion": "npm run clean && npm run check",
"version": "npm run build",
"postversion": "git push && git push --tags && npm run clean",
"prepublish": "npm run clean && npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/storcery/lore.git"
"url": "git+https://github.com/lore/lore.git"
},
"bugs": {
"url": "https://github.com/storcery/lore/issues"
"url": "https://github.com/lore/lore/issues"
},
"homepage": "https://github.com/storcery/lore#readme",
"scripts": {
"build": "../../node_modules/.bin/babel src --out-dir lib",
"clean": "rimraf lib",
"debug": "mocha debug --compilers js:babel-core/register --recursive",
"prepublish": "npm run build",
"test": "mocha --compilers js:babel-core/register --recursive"
},
"dependencies": {

@@ -36,18 +26,8 @@ "lodash": "^3.10.1"

"devDependencies": {
"babel-cli": "^6.4.5",
"babel-core": "^6.2.1",
"babel-eslint": "^4.1.6",
"babel-preset-es2015": "^6.1.18",
"bluebird": "^3.2.1",
"chai": "^3.4.1",
"eslint": "^1.7.1",
"eslint-config-airbnb": "^1.0.2",
"eslint-plugin-react": "^3.6.3",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.1",
"isparta": "^4.0.0",
"jquery-deferred": "^0.3.0",
"mocha": "^2.3.4",
"rimraf": "^2.4.4",
"rimraf": "^2.5.2",
"sinon": "^1.17.2"
}
}

@@ -7,3 +7,3 @@ const _ = require('lodash');

*/
module.exports = function(opts = {}) {
module.exports = function( opts = {} ) {
// clone the options so we don't unintentionally modify them

@@ -14,3 +14,3 @@ let options = _.cloneDeep(opts);

if (!options.model) {
if ( !options.model ) {
throw new Error('Must specify a model');

@@ -23,8 +23,8 @@ }

return function create(params) {
return function(dispatch) {
return function create( params ) {
return function( dispatch ) {
const model = new Model(params);
model.save().done(function() {
if (options.onSuccess) {
model.save().then(function() {
if ( options.onSuccess ) {
dispatch({

@@ -35,7 +35,7 @@ type: options.onSuccess.actionType,

}
}).fail(function(response) {
if (options.onError) {
}).catch(function( response ) {
if ( options.onError ) {
const error = response.responseJSON;
if (options.onError.beforeDispatch) {
if ( options.onError.beforeDispatch ) {
options.onError.beforeDispatch(response, [model]);

@@ -51,3 +51,3 @@ }

if (options.optimistic) {
if ( options.optimistic ) {
return dispatch({

@@ -54,0 +54,0 @@ type: options.optimistic.actionType,

@@ -25,3 +25,3 @@ const _ = require('lodash');

proxyModel.destroy().done(function() {
proxyModel.destroy().then(function() {
if (options.onSuccess) {

@@ -35,3 +35,3 @@ dispatch({

}
}).fail(function(response) {
}).catch(function(response) {
if (options.onError) {

@@ -38,0 +38,0 @@ const error = response.responseJSON;

@@ -27,3 +27,3 @@ const _ = require('lodash');

model.fetch().done(function() {
model.fetch().then(function() {
if (options.onSuccess) {

@@ -35,3 +35,3 @@ dispatch({

}
}).fail(function(response) {
}).catch(function(response) {
if (options.onError) {

@@ -38,0 +38,0 @@ const error = response.responseJSON;

@@ -28,3 +28,3 @@ const _ = require('lodash');

data: query
}).done(function() {
}).then(function() {
if (options.onSuccess) {

@@ -37,3 +37,3 @@ dispatch({

}
}).fail(function(response) {
}).catch(function(response) {
if (options.onError) {

@@ -40,0 +40,0 @@ const error = response.responseJSON;

@@ -26,3 +26,3 @@ const _ = require('lodash');

proxyModel.save().done(function() {
proxyModel.save().then(function() {
if (options.onSuccess) {

@@ -37,3 +37,3 @@ dispatch({

}
}).fail(function(response) {
}).catch(function(response) {
if (options.onError) {

@@ -40,0 +40,0 @@ const error = response.responseJSON;

@@ -16,3 +16,3 @@ const defaultOptions = {

function hasPartialPair(handler) {
function hasPartialPair( handler ) {
const hasType = !!handler.actionType;

@@ -23,4 +23,4 @@ const hasState = !!handler.payloadState;

function validatePartialPairs(options) {
if (hasPartialPair(options.optimistic)) {
function validatePartialPairs( options ) {
if ( hasPartialPair(options.optimistic) ) {
throw new Error(

@@ -32,3 +32,3 @@ 'Found definition for only one of optimistic.actionType or ' +

if (hasPartialPair(options.onSuccess)) {
if ( hasPartialPair(options.onSuccess) ) {
throw new Error(

@@ -40,3 +40,3 @@ 'Found definition for only one of onSuccess.actionType or ' +

if (hasPartialPair(options.onError)) {
if ( hasPartialPair(options.onError) ) {
throw new Error(

@@ -49,3 +49,3 @@ 'Found definition for only one of onError.actionType or ' +

function payload(model, state, error) {
function payload( model, state, error ) {
return {

@@ -60,7 +60,7 @@ id: model.id,

function payloadCollection(collection, state, error) {
function payloadCollection( collection, state, error ) {
return {
state: state,
error: error || {},
data: collection.map(function(model) {
data: collection.models.map(function( model ) {
return payload(model, state, error);

@@ -67,0 +67,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