added backup and email client
This commit is contained in:
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
import { css } from 'goober';
|
||||
import { shouldForwardProp } from '../index';
|
||||
|
||||
describe('shouldForwardProp', () => {
|
||||
it('type', () => {
|
||||
expect(typeof shouldForwardProp).toEqual('function');
|
||||
});
|
||||
|
||||
it('shouldForwardProp', () => {
|
||||
const fn = shouldForwardProp((prop) => {
|
||||
// Filter out props prefixed with '$'
|
||||
return prop[0] !== '$';
|
||||
});
|
||||
|
||||
const props = {
|
||||
color: 'red',
|
||||
$shouldAnimate: true
|
||||
};
|
||||
|
||||
// 'render'
|
||||
fn(props);
|
||||
|
||||
expect(props).toEqual({ color: 'red' });
|
||||
});
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Should forward prop utility function
|
||||
* @param {Function} filterPropFunction The flter function
|
||||
*/
|
||||
export function shouldForwardProp(filterPropFunction) {
|
||||
/**
|
||||
* The forward props function passed to `setup`
|
||||
* @param {object} props
|
||||
*/
|
||||
function forwardProp(props) {
|
||||
for (let p in props) {
|
||||
if (!filterPropFunction(p)) {
|
||||
delete props[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return forwardProp;
|
||||
}
|
||||
Reference in New Issue
Block a user