Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
lucas.parsy
jio
Commits
c22120cb
Commit
c22120cb
authored
Aug 14, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replicatestorage.js action method improved
parent
d5e177e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
src/jio.storage/replicatestorage.js
src/jio.storage/replicatestorage.js
+22
-15
No files found.
src/jio.storage/replicatestorage.js
View file @
c22120cb
...
@@ -101,8 +101,23 @@
...
@@ -101,8 +101,23 @@
* @return {Number} if a < b: -1, if a > b: 1, else 0
* @return {Number} if a < b: -1, if a > b: 1, else 0
*/
*/
actions
.
ld
=
function
compareAsDate
(
a
,
b
)
{
actions
.
ld
=
function
compareAsDate
(
a
,
b
)
{
if
(
a
<
0
)
{
a
=
NaN
;
}
if
(
b
<
1
)
{
b
=
NaN
;
}
a
=
new
Date
(
a
);
a
=
new
Date
(
a
);
b
=
new
Date
(
b
);
b
=
new
Date
(
b
);
if
(
isNaN
(
a
.
getTime
()))
{
if
(
isNaN
(
b
.
getTime
()))
{
return
0
;
}
return
-
1
;
}
if
(
isNaN
(
b
.
getTime
()))
{
return
1
;
}
return
a
<
b
?
-
1
:
a
>
b
?
1
:
0
;
return
a
<
b
?
-
1
:
a
>
b
?
1
:
0
;
};
};
actions
[
'
lastest date
'
]
=
actions
.
ld
;
actions
[
'
lastest date
'
]
=
actions
.
ld
;
...
@@ -217,21 +232,6 @@
...
@@ -217,21 +232,6 @@
};
};
actions
[
'
shortest list
'
]
=
actions
.
sl
;
actions
[
'
shortest list
'
]
=
actions
.
sl
;
actions
.
ls
=
function
compareLengthAsString
(
a
,
b
)
{
if
(
a
===
undefined
||
a
===
null
)
{
a
=
0
;
}
else
{
a
=
a
.
toString
().
length
;
}
if
(
b
===
undefined
||
b
===
null
)
{
b
=
0
;
}
else
{
b
=
b
.
toString
().
length
;
}
return
a
<
b
?
-
1
:
a
>
b
?
1
:
0
;
};
actions
[
'
longest string
'
]
=
actions
.
ls
;
/**
/**
* Comparision function to compare elements as string length. This function
* Comparision function to compare elements as string length. This function
...
@@ -245,6 +245,13 @@
...
@@ -245,6 +245,13 @@
* @param {Any} b The second value
* @param {Any} b The second value
* @return {Number} if a < b: -1, if a > b: 1, else 0
* @return {Number} if a < b: -1, if a > b: 1, else 0
*/
*/
actions
.
ls
=
function
compareLengthAsString
(
a
,
b
)
{
a
=
a
.
toString
().
length
;
b
=
b
.
toString
().
length
;
return
a
<
b
?
-
1
:
a
>
b
?
1
:
0
;
};
actions
[
'
longest string
'
]
=
actions
.
ls
;
actions
.
ss
=
function
(
a
,
b
)
{
actions
.
ss
=
function
(
a
,
b
)
{
return
-
actions
.
ls
(
a
,
b
);
return
-
actions
.
ls
(
a
,
b
);
};
};
...
...
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