Repository URL to install this package:
|
Version:
8.0.0 ▾
|
const fromPairs = pairs => pairs.reduce((result, [key, value]) => ({ ...result, [key]: value }), {});
const toPairs = object => Object.entries(object);
const pickBy = predicate => object => fromPairs(toPairs(object).filter(([key]) => predicate(key)));
const pickDataAttributes = pickBy(key => key.startsWith('data-'));
export default pickDataAttributes;