Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
jio-main
Commits
bd52f34e
Commit
bd52f34e
authored
Apr 15, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drivetojiomapping: simplify document filtering
parent
122da4b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
src/jio.storage/drivetojiomapping.js
src/jio.storage/drivetojiomapping.js
+9
-4
test/jio.storage/drivetojiomapping.tests.js
test/jio.storage/drivetojiomapping.tests.js
+5
-1
No files found.
src/jio.storage/drivetojiomapping.js
View file @
bd52f34e
...
@@ -13,11 +13,13 @@
...
@@ -13,11 +13,13 @@
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
}
}
var
DOCUMENT_EXTENSION
=
"
.json
"
,
var
DOCUMENT_EXTENSION
=
"
.json
"
,
DOCUMENT_REGEXP
=
new
RegExp
(
"
^([
\\
w=]+)
"
+
DOCUMENT_EXTENSION
+
"
$
"
),
DOCUMENT_KEY
=
"
/.jio_documents/
"
,
DOCUMENT_KEY
=
"
/.jio_documents/
"
,
ROOT
=
"
/
"
;
ROOT
=
"
/
"
;
function
endsWith
(
str
,
suffix
)
{
return
str
.
indexOf
(
suffix
,
str
.
length
-
suffix
.
length
)
!==
-
1
;
}
FileSystemBridgeStorage
.
prototype
.
get
=
function
(
id
)
{
FileSystemBridgeStorage
.
prototype
.
get
=
function
(
id
)
{
var
context
=
this
;
var
context
=
this
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
...
@@ -166,8 +168,11 @@
...
@@ -166,8 +168,11 @@
var
key
;
var
key
;
for
(
key
in
result
)
{
for
(
key
in
result
)
{
if
(
result
.
hasOwnProperty
(
key
))
{
if
(
result
.
hasOwnProperty
(
key
))
{
if
(
DOCUMENT_REGEXP
.
test
(
key
))
{
if
(
endsWith
(
key
,
DOCUMENT_EXTENSION
))
{
result_dict
[
DOCUMENT_REGEXP
.
exec
(
key
)[
1
]]
=
null
;
result_dict
[
key
.
substring
(
0
,
key
.
length
-
DOCUMENT_EXTENSION
.
length
)]
=
null
;
}
}
}
}
}
}
...
...
test/jio.storage/drivetojiomapping.tests.js
View file @
bd52f34e
...
@@ -948,6 +948,7 @@
...
@@ -948,6 +948,7 @@
return
{
return
{
"
foo.json
"
:
{},
"
foo.json
"
:
{},
"
bar.json
"
:
{},
"
bar.json
"
:
{},
"
bar.html.json
"
:
{},
"
foobar.pasjson
"
:
{}
"
foobar.pasjson
"
:
{}
};
};
}
}
...
@@ -976,8 +977,11 @@
...
@@ -976,8 +977,11 @@
},
{
},
{
id
:
"
bar
"
,
id
:
"
bar
"
,
value
:
{}
value
:
{}
},
{
id
:
"
bar.html
"
,
value
:
{}
}],
}],
total_rows
:
2
total_rows
:
3
}
}
});
});
})
})
...
...
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