UNPKG
linagora-rse
Version:
latest (1.3.7)
1.3.7
1.3.5
Linagora RSE
github.com/linagora/openpaas-esn
linagora/openpaas-esn
linagora-rse
/
backend
/
helpers
/
db.js
18 lines
(13 loc)
•
244 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const
mongoose =
require
(
'mongoose'
);
const
ObjectId
= mongoose.
Types
.
ObjectId
;
function
isValidObjectId
(
id
) {
try
{
new
ObjectId
(id);
return
true
; }
catch
(err) {
return
false
; } }
module
.
exports
= { isValidObjectId };