Skip to content

Commit

Permalink
adds package.json and readme"
Browse files Browse the repository at this point in the history
  • Loading branch information
smohadjer committed Jan 11, 2018
1 parent 8b2b6c0 commit 0a2980a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 20 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# configurationLoader

configurationLoader.js loads configurations from a json file and then merges them with existing confiugrations using a flag (overwriteInlineConfigs) to decide which parameters should be overwritten. By default this flag is false, that is inline configurations take precedence over those set in json file. The loader returns a promise object which once resolved will give access to configuration object. This object has also getter and setter methods which should be used to get and set configuration parameters.

**Usage**
```javascript
configurationLoader({
json: 'url.to.configuration.json',
data: inline.configuration,
overwriteInlineConfigs: [optional boolean parameter]
}).then(function(data) {
window.myProject.configuration = data;
// It's now safe to run scripts depending on configuration parameters
});

var test = myProject.configuration.get('nameOfProperty');
```
File renamed without changes.
25 changes: 5 additions & 20 deletions configurationLoader.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
/*
DEV NOTES:
configurationLoader loads configurations from a json file and then merges them with existing confiugrations using a flag (overwriteInlineConfigs) to decide which parameters should be overwritten. By default this flag is false, that is inline configurations take precedence over those set in json file. The loader returns a promise object which once resolved will give access to configuration object. This object has also getter and setter methods which should be used to get and set configuration parameters.
Usage example:
configurationLoader({
json: 'url.to.configuration.json',
data: inline.configuration,
overwriteInlineConfigs: [boolean]
}).then(function(data) {
window.myProject.configuration = data;
//it's now safe to run scripts that depend on configuration parameters
});
var test = myProject.configuration.get('nameOfProperty');
*/
/**
* VI configurationLoader v1.0.0
* For documentation see:
* https://github.com/frontend-framework/configuration
*/

configurationLoader = function(options) {
'use strict';
Expand Down
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "configurationLoader",
"version": "1.0.0",
"description": "configurationLoader.js loads configurations from a json file and then merges them with existing confiugrations",
"main": "configurationLoader.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/frontend-framework/configuration.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/frontend-framework/configuration/issues"
},
"homepage": "https://github.com/frontend-framework/configuration#readme"
}

0 comments on commit 0a2980a

Please sign in to comment.