Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
You need to sign in or sign up before continuing.
Commit 9717f90c
authored
Jun 12, 2016
by
Felix Becker
Committed by
Mick Hansen
Jun 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES6 refactor of parameter-validator.js (#6079)
let, const, template strings, export default
1 parent
37c176a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
lib/utils/parameter-validator.js
lib/utils/parameter-validator.js
View file @
9717f90
'use strict'
;
var
_
=
require
(
'lodash'
);
var
util
=
require
(
'util'
);
const
_
=
require
(
'lodash'
);
const
util
=
require
(
'util'
);
function
validateDeprecation
(
value
,
expectation
,
options
)
{
if
(
!
options
.
deprecated
)
{
return
;
}
var
valid
=
value
instanceof
options
.
deprecated
||
Object
.
prototype
.
toString
.
call
(
value
)
===
Object
.
prototype
.
toString
.
call
(
options
.
deprecated
.
call
());
const
valid
=
value
instanceof
options
.
deprecated
||
Object
.
prototype
.
toString
.
call
(
value
)
===
Object
.
prototype
.
toString
.
call
(
options
.
deprecated
.
call
());
if
(
valid
)
{
var
message
=
util
.
format
(
'%s should not be of type "%s"'
,
util
.
inspect
(
value
),
options
.
deprecated
.
name
)
;
const
message
=
`
${
util
.
inspect
(
value
)}
should not be of type "
${
options
.
deprecated
.
name
}
"`
;
console
.
log
(
'DEPRECATION WARNING:'
,
options
.
deprecationWarning
||
message
);
}
...
...
@@ -26,7 +26,7 @@ function validate (value, expectation) {
return
true
;
}
throw
new
Error
(
util
.
format
(
'The parameter (value: %s) is no %s.'
,
value
,
expectation
.
name
)
);
throw
new
Error
(
`The parameter (value:
${
value
}
) is no
${
expectation
.
name
}
`
);
}
function
check
(
value
,
expectation
,
options
)
{
...
...
@@ -55,3 +55,5 @@ function check (value, expectation, options) {
}
module
.
exports
=
check
;
module
.
exports
.
check
=
check
;
module
.
exports
.
default
=
check
;
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment