Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
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
Boris Kocherov
renderjs
Commits
0bd5794b
Commit
0bd5794b
authored
Jul 25, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update external libraries.
parent
661b7ac5
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6724 additions
and
5318 deletions
+6724
-5318
Makefile
Makefile
+13
-2
lib/jio/complex_queries.js
lib/jio/complex_queries.js
+159
-14
lib/jio/jio.js
lib/jio/jio.js
+2
-2
lib/jquery/jquery.js
lib/jquery/jquery.js
+4497
-5265
lib/require/require.js
lib/require/require.js
+2053
-35
No files found.
Makefile
View file @
0bd5794b
...
...
@@ -12,7 +12,9 @@ all: external lint test build doc
#########################################
# Download all external libs
external
:
lib/sinon/sinon.js
\
lib/sinon/sinon-qunit.js
\
lib/jquery/jquery.js
\
lib/require/require.js
\
lib/qunit/qunit.js
\
lib/qunit/qunit.css
\
lib/jio/jio.js
\
...
...
@@ -24,9 +26,18 @@ lib/sinon/sinon.js:
@
mkdir
-p
$
(
@D
)
curl
-s
-o
$@
http://sinonjs.org/releases/sinon-1.7.3.js
lib/sinon/sinon-qunit.js
:
@
mkdir
-p
$
(
@D
)
# curl -s -o $@ http://sinonjs.org/releases/sinon-qunit-1.0.0.js
curl
-s
-o
$@
https://raw.github.com/jfromaniello/jmail/master/scripts/Tests/sinon-qunit-1.0.0.js
lib/jquery/jquery.js
:
@
mkdir
-p
$
(
@D
)
curl
-s
-o
$@
http://code.jquery.com/jquery-1.9.1.js
curl
-s
-o
$@
http://code.jquery.com/jquery-2.0.3.js
lib/require/require.js
:
@
mkdir
-p
$
(
@D
)
curl
-s
-o
$@
http://requirejs.org/docs/release/2.1.8/comments/require.js
lib/qunit/qunit.%
:
@
mkdir
-p
$
(
@D
)
...
...
@@ -69,4 +80,4 @@ lint: ${BUILDDIR}/$(RENDERJS).lint
doc
:
$(YUIDOC_CMD)
.
clean
:
rm
-rf
$(RENDERJS_MIN)
${BUILDDIR}
lib/sinon lib/jquery lib/qunit lib/jio
rm
-rf
$(RENDERJS_MIN)
${BUILDDIR}
lib/sinon lib/jquery lib/qunit lib/jio
lib/require
lib/jio/complex_queries.js
View file @
0bd5794b
...
...
@@ -741,6 +741,33 @@ function stringEscapeRegexpCharacters(string) {
_export
(
"
stringEscapeRegexpCharacters
"
,
stringEscapeRegexpCharacters
);
/**
* Convert metadata values to array of strings. ex:
*
* "a" -> ["a"],
* {"content": "a"} -> ["a"]
*
* @param {Any} value The metadata value
* @return {Array} The value in string array format
*/
function
metadataValueToStringArray
(
value
)
{
var
i
,
new_value
=
[];
if
(
value
===
undefined
)
{
return
undefined
;
}
if
(
!
Array
.
isArray
(
value
))
{
value
=
[
value
];
}
for
(
i
=
0
;
i
<
value
.
length
;
i
+=
1
)
{
if
(
typeof
value
[
i
]
===
'
object
'
)
{
new_value
[
i
]
=
value
[
i
].
content
;
}
else
{
new_value
[
i
]
=
value
[
i
];
}
}
return
new_value
;
}
/**
* A sort function to sort items by key
*
...
...
@@ -751,12 +778,50 @@ _export("stringEscapeRegexpCharacters", stringEscapeRegexpCharacters);
function
sortFunction
(
key
,
way
)
{
if
(
way
===
'
descending
'
)
{
return
function
(
a
,
b
)
{
return
a
[
key
]
<
b
[
key
]
?
1
:
a
[
key
]
>
b
[
key
]
?
-
1
:
0
;
// this comparison is 5 times faster than json comparison
var
i
,
l
;
a
=
metadataValueToStringArray
(
a
[
key
])
||
[];
b
=
metadataValueToStringArray
(
b
[
key
])
||
[];
l
=
a
.
length
>
b
.
length
?
a
.
length
:
b
.
length
;
for
(
i
=
0
;
i
<
l
;
i
+=
1
)
{
if
(
a
[
i
]
===
undefined
)
{
return
1
;
}
if
(
b
[
i
]
===
undefined
)
{
return
-
1
;
}
if
(
a
[
i
]
>
b
[
i
])
{
return
-
1
;
}
if
(
a
[
i
]
<
b
[
i
])
{
return
1
;
}
}
return
0
;
};
}
if
(
way
===
'
ascending
'
)
{
return
function
(
a
,
b
)
{
return
a
[
key
]
>
b
[
key
]
?
1
:
a
[
key
]
<
b
[
key
]
?
-
1
:
0
;
// this comparison is 5 times faster than json comparison
var
i
,
l
;
a
=
metadataValueToStringArray
(
a
[
key
])
||
[];
b
=
metadataValueToStringArray
(
b
[
key
])
||
[];
l
=
a
.
length
>
b
.
length
?
a
.
length
:
b
.
length
;
for
(
i
=
0
;
i
<
l
;
i
+=
1
)
{
if
(
a
[
i
]
===
undefined
)
{
return
-
1
;
}
if
(
b
[
i
]
===
undefined
)
{
return
1
;
}
if
(
a
[
i
]
>
b
[
i
])
{
return
1
;
}
if
(
a
[
i
]
<
b
[
i
])
{
return
-
1
;
}
}
return
0
;
};
}
throw
new
TypeError
(
"
complex_queries.sortFunction():
"
+
...
...
@@ -1238,10 +1303,34 @@ SimpleQuery.prototype.serialized = function () {
*/
SimpleQuery
.
prototype
[
"
=
"
]
=
function
(
object_value
,
comparison_value
,
wildcard_character
)
{
return
convertStringToRegExp
(
comparison_value
.
toString
(),
wildcard_character
||
"
%
"
).
test
(
object_value
.
toString
());
var
value
,
i
;
if
(
!
Array
.
isArray
(
object_value
))
{
object_value
=
[
object_value
];
}
for
(
i
=
0
;
i
<
object_value
.
length
;
i
+=
1
)
{
value
=
object_value
[
i
];
if
(
typeof
value
===
'
object
'
)
{
value
=
value
.
content
;
}
if
(
comparison_value
===
undefined
)
{
if
(
value
===
undefined
)
{
return
true
;
}
return
false
;
}
if
(
value
===
undefined
)
{
return
false
;
}
if
(
convertStringToRegExp
(
comparison_value
.
toString
(),
wildcard_character
).
test
(
value
.
toString
())
)
{
return
true
;
}
}
return
false
;
};
/**
...
...
@@ -1255,10 +1344,34 @@ SimpleQuery.prototype["="] = function (object_value, comparison_value,
*/
SimpleQuery
.
prototype
[
"
!=
"
]
=
function
(
object_value
,
comparison_value
,
wildcard_character
)
{
return
!
convertStringToRegExp
(
comparison_value
.
toString
(),
wildcard_character
||
"
%
"
).
test
(
object_value
.
toString
());
var
value
,
i
;
if
(
!
Array
.
isArray
(
object_value
))
{
object_value
=
[
object_value
];
}
for
(
i
=
0
;
i
<
object_value
.
length
;
i
+=
1
)
{
value
=
object_value
[
i
];
if
(
typeof
value
===
'
object
'
)
{
value
=
value
.
content
;
}
if
(
comparison_value
===
undefined
)
{
if
(
value
===
undefined
)
{
return
false
;
}
return
true
;
}
if
(
value
===
undefined
)
{
return
true
;
}
if
(
convertStringToRegExp
(
comparison_value
.
toString
(),
wildcard_character
).
test
(
value
.
toString
())
)
{
return
false
;
}
}
return
true
;
};
/**
...
...
@@ -1270,7 +1383,15 @@ SimpleQuery.prototype["!="] = function (object_value, comparison_value,
* @return {Boolean} true if lower, false otherwise
*/
SimpleQuery
.
prototype
[
"
<
"
]
=
function
(
object_value
,
comparison_value
)
{
return
object_value
<
comparison_value
;
var
value
;
if
(
!
Array
.
isArray
(
object_value
))
{
object_value
=
[
object_value
];
}
value
=
object_value
[
0
];
if
(
typeof
value
===
'
object
'
)
{
value
=
value
.
content
;
}
return
value
<
comparison_value
;
};
/**
...
...
@@ -1283,7 +1404,15 @@ SimpleQuery.prototype["<"] = function (object_value, comparison_value) {
* @return {Boolean} true if equal or lower, false otherwise
*/
SimpleQuery
.
prototype
[
"
<=
"
]
=
function
(
object_value
,
comparison_value
)
{
return
object_value
<=
comparison_value
;
var
value
;
if
(
!
Array
.
isArray
(
object_value
))
{
object_value
=
[
object_value
];
}
value
=
object_value
[
0
];
if
(
typeof
value
===
'
object
'
)
{
value
=
value
.
content
;
}
return
value
<=
comparison_value
;
};
/**
...
...
@@ -1296,7 +1425,15 @@ SimpleQuery.prototype["<="] = function (object_value, comparison_value) {
* @return {Boolean} true if greater, false otherwise
*/
SimpleQuery
.
prototype
[
"
>
"
]
=
function
(
object_value
,
comparison_value
)
{
return
object_value
>
comparison_value
;
var
value
;
if
(
!
Array
.
isArray
(
object_value
))
{
object_value
=
[
object_value
];
}
value
=
object_value
[
0
];
if
(
typeof
value
===
'
object
'
)
{
value
=
value
.
content
;
}
return
value
>
comparison_value
;
};
/**
...
...
@@ -1309,7 +1446,15 @@ SimpleQuery.prototype[">"] = function (object_value, comparison_value) {
* @return {Boolean} true if equal or greater, false otherwise
*/
SimpleQuery
.
prototype
[
"
>=
"
]
=
function
(
object_value
,
comparison_value
)
{
return
object_value
>=
comparison_value
;
var
value
;
if
(
!
Array
.
isArray
(
object_value
))
{
object_value
=
[
object_value
];
}
value
=
object_value
[
0
];
if
(
typeof
value
===
'
object
'
)
{
value
=
value
.
content
;
}
return
value
>=
comparison_value
;
};
query_class_dict
.
simple
=
SimpleQuery
;
...
...
lib/jio/jio.js
View file @
0bd5794b
...
...
@@ -531,13 +531,13 @@ var command = function (spec, my) {
* @param {object} storage The storage.
*/
that
.
validate
=
function
(
storage
)
{
if
(
typeof
priv
.
doc
.
_id
===
"
string
"
&&
priv
.
doc
.
_id
.
match
(
"
"
)
)
{
if
(
typeof
priv
.
doc
.
_id
===
"
string
"
&&
priv
.
doc
.
_id
===
""
)
{
that
.
error
({
"
status
"
:
21
,
"
statusText
"
:
"
Invalid Document Id
"
,
"
error
"
:
"
invalid_document_id
"
,
"
message
"
:
"
The document id is invalid
"
,
"
reason
"
:
"
The document id contains spaces
"
"
reason
"
:
"
empty
"
});
return
false
;
}
...
...
lib/jquery/jquery.js
View file @
0bd5794b
This diff is collapsed.
Click to expand it.
lib/require/require.js
View file @
0bd5794b
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