Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李楚霏
/
refactorTest
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
746023e1
authored
5 years ago
by
李楚霏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
task--5 提炼函数step1
parent
11022629
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
length/src/index.js
+13
-5
No files found.
length/src/index.js
View file @
746023e1
...
@@ -19,15 +19,15 @@ export class Length {
...
@@ -19,15 +19,15 @@ export class Length {
let
unitLength
=
this
let
unitLength
=
this
if
(
this
.
unit
===
Constants
.
Constants
.
YARD
)
{
if
(
this
.
unit
===
Constants
.
Constants
.
YARD
)
{
if
(
unitNode
===
Constants
.
Constants
.
FOOT
)
{
if
(
unitNode
===
Constants
.
Constants
.
FOOT
)
{
unitLength
=
new
Length
(
this
.
value
*
3
,
unitNode
)
unitLength
=
new
Length
(
this
.
multipleValue
(
3
)
,
unitNode
)
}
else
if
(
unitNode
===
Constants
.
Constants
.
INCH
)
{
}
else
if
(
unitNode
===
Constants
.
Constants
.
INCH
)
{
unitLength
=
new
Length
(
this
.
value
*
36
,
unitNode
)
unitLength
=
new
Length
(
this
.
multipleValue
(
36
)
,
unitNode
)
}
}
}
}
if
(
this
.
unit
===
Constants
.
Constants
.
INCH
)
{
if
(
this
.
unit
===
Constants
.
Constants
.
INCH
)
{
if
(
unitNode
===
Constants
.
Constants
.
YARD
)
{
if
(
unitNode
===
Constants
.
Constants
.
YARD
)
{
unitLength
=
new
Length
(
this
.
value
/
36
,
unitNode
)
unitLength
=
new
Length
(
this
.
divisionValue
(
36
)
,
unitNode
)
}
else
if
(
unitNode
===
Constants
.
Constants
.
FOOT
)
{
}
else
if
(
unitNode
===
Constants
.
Constants
.
FOOT
)
{
unitLength
=
new
Length
(
this
.
value
/
12
,
unitNode
)
unitLength
=
new
Length
(
this
.
value
/
12
,
unitNode
)
}
}
...
@@ -35,12 +35,20 @@ export class Length {
...
@@ -35,12 +35,20 @@ export class Length {
if
(
this
.
unit
===
Constants
.
Constants
.
FOOT
)
{
if
(
this
.
unit
===
Constants
.
Constants
.
FOOT
)
{
if
(
unitNode
===
Constants
.
Constants
.
YARD
)
{
if
(
unitNode
===
Constants
.
Constants
.
YARD
)
{
unitLength
=
new
Length
(
this
.
value
/
3
,
unitNode
)
unitLength
=
new
Length
(
this
.
divisionValue
(
3
)
,
unitNode
)
}
else
if
(
unitNode
===
Constants
.
Constants
.
INCH
)
{
}
else
if
(
unitNode
===
Constants
.
Constants
.
INCH
)
{
unitLength
=
new
Length
(
this
.
value
*
12
,
unitNode
)
unitLength
=
new
Length
(
this
.
multipleValue
(
12
)
,
unitNode
)
}
}
}
}
return
unitLength
return
unitLength
}
}
divisionValue
(
conversion_Target_Unit_Value
)
{
return
this
.
value
/
conversion_Target_Unit_Value
}
multipleValue
(
conversion_Target_Unit_Value
)
{
return
this
.
value
*
conversion_Target_Unit_Value
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment