Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
28c7a7c1
Commit
28c7a7c1
authored
Jan 11, 2017
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
Use airbnb line length definition
parent
19a4dc1b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.eslintrc.js
+0
-1
0 additions, 1 deletion
.eslintrc.js
src/helpers/packageJson.js
+12
-4
12 additions, 4 deletions
src/helpers/packageJson.js
with
12 additions
and
5 deletions
.eslintrc.js
+
0
−
1
View file @
28c7a7c1
...
@@ -10,7 +10,6 @@ module.exports = {
...
@@ -10,7 +10,6 @@ module.exports = {
'
promise
'
,
'
promise
'
,
],
],
'
rules
'
:
{
'
rules
'
:
{
'
max-len
'
:
[
1
,
120
],
'
no-console
'
:
0
,
'
no-console
'
:
0
,
'
no-use-before-define
'
:
0
,
'
no-use-before-define
'
:
0
,
'
promise/always-return
'
:
'
error
'
,
'
promise/always-return
'
:
'
error
'
,
...
...
This diff is collapsed.
Click to expand it.
src/helpers/packageJson.js
+
12
−
4
View file @
28c7a7c1
...
@@ -17,11 +17,9 @@ module.exports = {
...
@@ -17,11 +17,9 @@ module.exports = {
// Iterate through the rest of the file
// Iterate through the rest of the file
for
(;
searchIndex
<
currentFileContent
.
length
;
searchIndex
+=
1
)
{
for
(;
searchIndex
<
currentFileContent
.
length
;
searchIndex
+=
1
)
{
// First check if we have a hit for the old version
// First check if we have a hit for the old version
if
(
currentFileContent
.
substring
(
searchIndex
,
searchIndex
+
searchString
.
length
)
===
searchString
)
{
if
(
matchAt
(
currentFileContent
,
searchIndex
,
searchString
)
)
{
// Now test if the result matches
// Now test if the result matches
const
testContent
=
currentFileContent
.
substr
(
0
,
searchIndex
)
+
const
testContent
=
replaceAt
(
currentFileContent
,
searchIndex
,
searchString
,
newString
);
newString
+
currentFileContent
.
substr
(
searchIndex
+
searchString
.
length
);
// Compare the parsed JSON structure of old and new
// Compare the parsed JSON structure of old and new
if
(
_
.
isEqual
(
parsedContents
,
JSON
.
parse
(
testContent
)))
{
if
(
_
.
isEqual
(
parsedContents
,
JSON
.
parse
(
testContent
)))
{
newFileContent
=
testContent
;
newFileContent
=
testContent
;
...
@@ -35,3 +33,13 @@ module.exports = {
...
@@ -35,3 +33,13 @@ module.exports = {
return
newFileContent
;
return
newFileContent
;
},
},
};
};
// Return true if the match string is found at index in content
function
matchAt
(
content
,
index
,
match
)
{
return
content
.
substring
(
index
,
index
+
match
.
length
)
===
match
;
}
// Replace oldString with newString at location index of content
function
replaceAt
(
content
,
index
,
oldString
,
newString
)
{
return
content
.
substr
(
0
,
index
)
+
newString
+
content
.
substr
(
index
,
oldString
.
length
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment