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

async-selector

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-selector - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

34

__tests__/index.test.js

@@ -814,2 +814,36 @@ import createAsyncSelector from '../src/index';

}, 200);
});
test('Throw error', () => {
try {
createAsyncSelector();
} catch (e) {
expect(e.message).toBe('An object of parameters must be passed in');
}
});
test('selector.getResult', done => {
let c = 0;
let state = {employees: ['Mark Metzger'], maxAge: 10};
const ages = createAsyncSelector(params2, s => s.employees, s => s.maxAge);
const result = ages(state);
const expected = {
value: [],
previous: [],
isWaiting: false,
isResolved: true,
isRejected: false,
}
ages(state);
setTimeout(() => {
try {
expect(deepEqual(ages.getResult(), expected)).toBe(true);
} catch (e) {
done.fail(e)
}
done();
}, 200);
});

9

dist/index.js

@@ -13,9 +13,9 @@ 'use strict';

if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) !== 'object' || params === null) {
throw new Exception('An object of parameters must be passed in');
throw new Error('An object of parameters must be passed in');
}
if (typeof params.sync !== 'function') {
throw new Exception('Looking for a function called "sync". This function is called to before the promise resolves');
throw new Error('Looking for a function called "sync". This function is called to before the promise resolves');
}
if (typeof params.async !== 'function') {
throw new Exception('Looking for a function called "async". This function returns a promise which handles asynchronous code');
throw new Error('Looking for a function called "async". This function returns a promise which handles asynchronous code');
}

@@ -130,2 +130,5 @@ }

};
func.getResult = function () {
return memoizedResult;
};
return func;

@@ -132,0 +135,0 @@ }

{
"name": "async-selector",
"version": "1.0.11",
"version": "1.0.12",
"description": "Select values from databases using asynchronous selectors.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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