UNPKG
get-express-starter
Version:
latest (3.1.0)
3.1.0
3.0.0
2.1.2
2.1.1
2.0.1
1.1.1
1.1.0
1.0.0
0.1.0
Get production ready express boilerplate with a single command
get-express-starter
/
templates
/
express-postgres-prisma
/
src
/
utils
/
pick.ts
12 lines
(11 loc)
•
320 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
export
const
pick = <T
extends
Record
<
string
,
any
>, K
extends
keyof T>(
object
: T,
keys
: K[]):
Pick
<T, K> => {
return
keys.
reduce
(
(
obj, key
) =>
{
if
(
object
&&
Object
.
prototype
.
hasOwnProperty
.
call
(
object
, key)) { obj[key] =
object
[key]; }
return
obj; }, {}
as
Pick
<T, K>, ); };