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
不要怂,就是干,撸起袖子干!
Commit 28224cc3
authored
May 01, 2012
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toDefaultValue method
1 parent
586a854c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
lib/utils.js
lib/utils.js
View file @
28224cc
var
client
=
new
(
require
(
"mysql"
).
Client
)()
,
util
=
require
(
"util"
)
var
client
=
new
(
require
(
"mysql"
).
Client
)()
,
util
=
require
(
"util"
)
,
DataTypes
=
require
(
"./data-types"
)
var
Utils
=
module
.
exports
=
{
_
:
(
function
()
{
...
...
@@ -71,23 +72,31 @@ var Utils = module.exports = {
combineTableNames
:
function
(
tableName1
,
tableName2
)
{
return
(
tableName1
.
toLowerCase
()
<
tableName2
.
toLowerCase
())
?
(
tableName1
+
tableName2
)
:
(
tableName2
+
tableName1
)
},
singularize
:
function
(
s
)
{
return
Utils
.
Lingo
.
en
.
isSingular
(
s
)
?
s
:
Utils
.
Lingo
.
en
.
singularize
(
s
)
},
pluralize
:
function
(
s
)
{
return
Utils
.
Lingo
.
en
.
isPlural
(
s
)
?
s
:
Utils
.
Lingo
.
en
.
pluralize
(
s
)
},
merge
:
function
(
a
,
b
){
for
(
var
key
in
b
)
{
a
[
key
]
=
b
[
key
]
}
return
a
},
removeCommentsFromFunctionString
:
function
(
s
)
{
s
=
s
.
replace
(
/
\s
*
(\/\/
.*
)
/g
,
''
)
s
=
s
.
replace
(
/
(\/\*[\n\r\s\S]
*
?\*\/)
/mg
,
''
)
return
s
},
toDefaultValue
:
function
(
value
)
{
return
(
value
==
DataTypes
.
NOW
)
?
new
Date
()
:
value
}
}
...
...
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