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
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 @@
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
}
var
DOCUMENT_EXTENSION
=
"
.json
"
,
DOCUMENT_REGEXP
=
new
RegExp
(
"
^([
\\
w=]+)
"
+
DOCUMENT_EXTENSION
+
"
$
"
),
DOCUMENT_KEY
=
"
/.jio_documents/
"
,
ROOT
=
"
/
"
;
function
endsWith
(
str
,
suffix
)
{
return
str
.
indexOf
(
suffix
,
str
.
length
-
suffix
.
length
)
!==
-
1
;
}
FileSystemBridgeStorage
.
prototype
.
get
=
function
(
id
)
{
var
context
=
this
;
return
new
RSVP
.
Queue
()
...
...
@@ -166,8 +168,11 @@
var
key
;
for
(
key
in
result
)
{
if
(
result
.
hasOwnProperty
(
key
))
{
if
(
DOCUMENT_REGEXP
.
test
(
key
))
{
result_dict
[
DOCUMENT_REGEXP
.
exec
(
key
)[
1
]]
=
null
;
if
(
endsWith
(
key
,
DOCUMENT_EXTENSION
))
{
result_dict
[
key
.
substring
(
0
,
key
.
length
-
DOCUMENT_EXTENSION
.
length
)]
=
null
;
}
}
}
...
...
test/jio.storage/drivetojiomapping.tests.js
View file @
bd52f34e
...
...
@@ -948,6 +948,7 @@
return
{
"
foo.json
"
:
{},
"
bar.json
"
:
{},
"
bar.html.json
"
:
{},
"
foobar.pasjson
"
:
{}
};
}
...
...
@@ -976,8 +977,11 @@
},
{
id
:
"
bar
"
,
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