This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from esender/eslint
introduce eslint
- Loading branch information
Showing
8 changed files
with
32 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
function addResource(resourceName, subResources) { | ||
function carredResource (parentPath = '') { | ||
let path = `${parentPath}/${resourceName}`; | ||
function addResource(resourceName, subResources = []) { | ||
function carriedResource(parentPath = '') { | ||
const path = `${parentPath}/${resourceName}`; | ||
|
||
function resource(id) { | ||
let paths = {}; | ||
const paths = {}; | ||
|
||
paths.path = `${path}/${id}`; | ||
|
||
if(subResources) { | ||
subResources.forEach( resource => { | ||
paths[resource.resourceName] = resource(paths.path); | ||
}); | ||
} | ||
subResources.forEach((subResource) => { | ||
paths[subResource.resourceName] = subResource(paths.path); | ||
}); | ||
|
||
return paths; | ||
} | ||
|
||
resource.path = path; | ||
|
||
if (subResources) { | ||
subResources.forEach( subResource => { | ||
resource[subResource.resourceName] = subResource(path); | ||
}); | ||
} | ||
subResources.forEach((subResource) => { | ||
resource[subResource.resourceName] = subResource(path); | ||
}); | ||
|
||
return resource; | ||
} | ||
|
||
carredResource.resourceName = resourceName; | ||
return carredResource; | ||
carriedResource.resourceName = resourceName; | ||
|
||
return carriedResource; | ||
} | ||
|
||
export default addResource; | ||
export default addResource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters