@rematch/select
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,7 +0,12 @@ | ||
import { Plugin } from '../../../typings/rematch'; | ||
import { ExtractRematchSelectorsFromModels, Models, Plugin } from '../../../typings/rematch'; | ||
export declare const select: {}; | ||
export declare function getSelect<M extends Models = Models>(): ExtractRematchSelectorsFromModels<M, any>; | ||
export interface SelectConfig { | ||
sliceState?: any; | ||
} | ||
declare const selectPlugin: ({ sliceState, }?: SelectConfig) => Plugin; | ||
declare const selectPlugin: ({ sliceState, }?: SelectConfig) => Plugin<Models, { | ||
type: string; | ||
payload?: any; | ||
meta?: any; | ||
}>; | ||
export default selectPlugin; |
@@ -1,2 +0,2 @@ | ||
"use strict";function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}Object.defineProperty(exports,"__esModule",{value:!0});var lib=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={};t.default=function(e){var o=(void 0===e?{}:e).sliceState,n=void 0===o?function(e,t){return e[t.name]}:o;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof n,"The selectPlugin's getState config must be a function. Instead got type "+typeof n+"."]])},onModel:function(e){var o=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(r){o.validate([["function"!=typeof e.selectors[r],"Selector ("+e.name+"/"+r+") must be a function"]]),t.select[e.name][r]=function(t){for(var o,s=[],c=1;arguments.length>c;c++)s[c-1]=arguments[c];return(o=e.selectors)[r].apply(o,[n(t,e)].concat(s))}})}}}}),index=unwrapExports(lib),lib_1=lib.select;exports.default=index,exports.select=lib_1; | ||
"use strict";function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}Object.defineProperty(exports,"__esModule",{value:!0});var lib=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={},t.getSelect=function(){return t.select};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(l){n.validate([["function"!=typeof e.selectors[l],"Selector ("+e.name+"/"+l+") must be a function"]]),t.select[e.name][l]=function(t){for(var n,c=[],r=1;arguments.length>r;r++)c[r-1]=arguments[r];return(n=e.selectors)[l].apply(n,[o(t,e)].concat(c))}})}}}}),index=unwrapExports(lib),lib_1=lib.select,lib_2=lib.getSelect;exports.default=index,exports.select=lib_1,exports.getSelect=lib_2; | ||
//# sourceMappingURL=rematch-select.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(c){n.validate([["function"!=typeof e.selectors[c],"Selector ("+e.name+"/"+c+") must be a function"]]),t.select[e.name][c]=function(t){for(var n,r=[],l=1;arguments.length>l;l++)r[l-1]=arguments[l];return(n=e.selectors)[c].apply(n,[o(t,e)].concat(r))}})}}}}),index=unwrapExports(lib),lib_1=lib.select;export default index;export{lib_1 as select}; | ||
function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={},t.getSelect=function(){return t.select};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(l){n.validate([["function"!=typeof e.selectors[l],"Selector ("+e.name+"/"+l+") must be a function"]]),t.select[e.name][l]=function(t){for(var n,c=[],r=1;arguments.length>r;r++)c[r-1]=arguments[r];return(n=e.selectors)[l].apply(n,[o(t,e)].concat(c))}})}}}}),index=unwrapExports(lib),lib_1=lib.select,lib_2=lib.getSelect;export default index;export{lib_1 as select,lib_2 as getSelect}; | ||
//# sourceMappingURL=rematch-select.esm.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RematchSelect={})}(this,function(e){"use strict";var t,n,o=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(c){n.validate([["function"!=typeof e.selectors[c],"Selector ("+e.name+"/"+c+") must be a function"]]),t.select[e.name][c]=function(t){for(var n,s=[],f=1;arguments.length>f;f++)s[f-1]=arguments[f];return(n=e.selectors)[c].apply(n,[o(t,e)].concat(s))}})}}}}(t={exports:{}},t.exports),t.exports),c=(n=o)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,s=o.select;e.default=c,e.select=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RematchSelect={})}(this,function(e){"use strict";var t,n,o=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={},t.getSelect=function(){return t.select};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(c){n.validate([["function"!=typeof e.selectors[c],"Selector ("+e.name+"/"+c+") must be a function"]]),t.select[e.name][c]=function(t){for(var n,s=[],l=1;arguments.length>l;l++)s[l-1]=arguments[l];return(n=e.selectors)[c].apply(n,[o(t,e)].concat(s))}})}}}}(t={exports:{}},t.exports),t.exports),c=(n=o)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,s=o.select,l=o.getSelect;e.default=c,e.select=s,e.getSelect=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=rematch-select.umd.js.map |
import index from './dist'; | ||
import { ExtractRematchSelectorsFromModels, Models } from '../../typings/rematch/index' | ||
// @ts-ignore | ||
export const select = {} | ||
// @ts-ignore | ||
export function getSelect<M extends Models = Models>() { | ||
return select as ExtractRematchSelectorsFromModels<M> | ||
} | ||
export * from './dist'; | ||
export default index; |
{ | ||
"name": "@rematch/select", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Selectors plugin for Rematch", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -16,9 +16,9 @@ # Rematch Select | ||
```js | ||
import selectorsPlugin from '@rematch/select' | ||
import selectPlugin, { getSelect } from '@rematch/select' | ||
import { init } from '@rematch/core' | ||
const select = selectorsPlugin() | ||
export const select = getSelect(); | ||
init({ | ||
plugins: [select] | ||
plugins: [selectPlugin()] | ||
}) | ||
@@ -69,2 +69,3 @@ ``` | ||
total: createSelector( | ||
state => state, | ||
state => state.reduce((a, b) => a + (b.price * b.amount), 0) | ||
@@ -71,0 +72,0 @@ ) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17037
40
112