-
Notifications
You must be signed in to change notification settings - Fork 0
Working with plain objects
Conan edited this page May 6, 2022
·
4 revisions
import { sift, byPattern } from 'sift-r'
// 1:
//
const [strValues, theRest] = sift({
title: [isString, 'header'],
slug: [isString, 1],
markdown: [isString, '# header'],
footer: [isString, undefined]
})
// 2:
//
const [strValues, theRest] = sift(
{
title: 'header',
slug: 1,
markdown: '# header',
footer: undefined
},
{
title: isString,
slug: isString,
markdown: isString,
footer: isString
}
)
// 3:
//
const [strValues, theRest] = sift(
{
title: 'header',
slug: 1,
markdown: '# header',
footer: undefined
},
isString
)
// 4:
//
const [strValues, numValues, neither] = sift(
{
title: 'header',
slug: 1,
markdown: '# header',
footer: undefined
},
[isString, isNumber]
)
sift-r
📥 | on npm | docs home | top of page