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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
jio
Commits
5f88fd5b
Commit
5f88fd5b
authored
Jun 13, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queries: removing uneeded attribute + fix scope bug
parent
608513da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
19 deletions
+9
-19
src/queries/complexquery.js
src/queries/complexquery.js
+0
-1
src/queries/query.js
src/queries/query.js
+7
-15
src/queries/simplequery.js
src/queries/simplequery.js
+2
-3
No files found.
src/queries/complexquery.js
View file @
5f88fd5b
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
* @param {String} [spec.operator="AND"] The compare method to use
* @param {String} [spec.operator="AND"] The compare method to use
* @param {String} spec.key The metadata key
* @param {String} spec.key The metadata key
* @param {String} spec.value The value of the metadata to compare
* @param {String} spec.value The value of the metadata to compare
* @param {String} [spec.wildcard_character="%"] The wildcard character
*/
*/
var
ComplexQuery
=
newClass
(
Query
,
function
(
spec
)
{
var
ComplexQuery
=
newClass
(
Query
,
function
(
spec
)
{
...
...
src/queries/query.js
View file @
5f88fd5b
...
@@ -9,17 +9,9 @@
...
@@ -9,17 +9,9 @@
* @class Query
* @class Query
* @constructor
* @constructor
*/
*/
var
Query
=
newClass
(
function
(
spec
)
{
var
Query
=
newClass
(
function
()
{
/**
var
that
=
this
,
emptyFunction
=
function
()
{};
* The wildcard character used to extend comparison action
*
* @attribute wildcard_character
* @type String
* @default "%"
* @optional
*/
this
.
wildcard_character
=
spec
.
wildcard_character
||
"
%
"
;
/**
/**
* Filter the item list with matching item only
* Filter the item list with matching item only
...
@@ -34,10 +26,10 @@ var Query = newClass(function (spec) {
...
@@ -34,10 +26,10 @@ var Query = newClass(function (spec) {
* @param {Array} [option.limit] Couple of integer, first is an index and
* @param {Array} [option.limit] Couple of integer, first is an index and
* second is the length.
* second is the length.
*/
*/
th
is
.
exec
=
function
(
item_list
,
option
)
{
th
at
.
exec
=
function
(
item_list
,
option
)
{
var
i
=
0
;
var
i
=
0
;
while
(
i
<
item_list
.
length
)
{
while
(
i
<
item_list
.
length
)
{
if
(
!
th
is
.
match
(
item_list
[
i
],
option
.
wildcard_character
))
{
if
(
!
th
at
.
match
(
item_list
[
i
],
option
.
wildcard_character
))
{
item_list
.
splice
(
i
,
1
);
item_list
.
splice
(
i
,
1
);
}
else
{
}
else
{
i
+=
1
;
i
+=
1
;
...
@@ -62,7 +54,7 @@ var Query = newClass(function (spec) {
...
@@ -62,7 +54,7 @@ var Query = newClass(function (spec) {
* @param {Object} item The object to test
* @param {Object} item The object to test
* @return {Boolean} true if match, false otherwise
* @return {Boolean} true if match, false otherwise
*/
*/
th
is
.
match
=
function
(
item
,
wildcard_character
)
{
th
at
.
match
=
function
(
item
,
wildcard_character
)
{
return
true
;
return
true
;
};
};
...
@@ -73,7 +65,7 @@ var Query = newClass(function (spec) {
...
@@ -73,7 +65,7 @@ var Query = newClass(function (spec) {
* @method toString
* @method toString
* @return {String} The string version of this query
* @return {String} The string version of this query
*/
*/
th
is
.
toString
=
function
()
{
th
at
.
toString
=
function
()
{
return
""
;
return
""
;
};
};
...
@@ -84,7 +76,7 @@ var Query = newClass(function (spec) {
...
@@ -84,7 +76,7 @@ var Query = newClass(function (spec) {
* @method serialized
* @method serialized
* @return {Object} The jsonable object
* @return {Object} The jsonable object
*/
*/
th
is
.
serialized
=
function
()
{
th
at
.
serialized
=
function
()
{
return
undefined
;
return
undefined
;
};
};
...
...
src/queries/simplequery.js
View file @
5f88fd5b
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
* @param {String} [spec.operator="="] The compare method to use
* @param {String} [spec.operator="="] The compare method to use
* @param {String} spec.key The metadata key
* @param {String} spec.key The metadata key
* @param {String} spec.value The value of the metadata to compare
* @param {String} spec.value The value of the metadata to compare
* @param {String} [spec.wildcard_character="%"] The wildcard character
*/
*/
var
SimpleQuery
=
newClass
(
Query
,
function
(
spec
)
{
var
SimpleQuery
=
newClass
(
Query
,
function
(
spec
)
{
/**
/**
...
@@ -80,7 +79,7 @@ var SimpleQuery = newClass(Query, function (spec) {
...
@@ -80,7 +79,7 @@ var SimpleQuery = newClass(Query, function (spec) {
wildcard_character
)
{
wildcard_character
)
{
return
convertSearchTextToRegExp
(
return
convertSearchTextToRegExp
(
comparison_value
.
toString
(),
comparison_value
.
toString
(),
wildcard_character
||
this
.
wildcard_character
wildcard_character
||
"
%
"
).
test
(
object_value
.
toString
());
).
test
(
object_value
.
toString
());
};
};
...
@@ -97,7 +96,7 @@ var SimpleQuery = newClass(Query, function (spec) {
...
@@ -97,7 +96,7 @@ var SimpleQuery = newClass(Query, function (spec) {
wildcard_character
)
{
wildcard_character
)
{
return
!
convertSearchTextToRegExp
(
return
!
convertSearchTextToRegExp
(
comparison_value
.
toString
(),
comparison_value
.
toString
(),
wildcard_character
||
this
.
wildcard_character
wildcard_character
||
"
%
"
).
test
(
object_value
.
toString
());
).
test
(
object_value
.
toString
());
};
};
...
...
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