New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-env

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-env - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

2

package.json

@@ -19,3 +19,3 @@ {

},
"version": "0.1.1"
"version": "0.2.0"
}

@@ -19,2 +19,10 @@ # vue-env

A secondary parameter can be set right away also for environment specific config.
~~~
import _env from './env.js';
Vue.use(require('vue-env'), _env, require('./config/' + _env.APP_ENV + '.js'));
~~~
After that just use the `get()` method to fetch environment constants.

@@ -25,2 +33,5 @@

this.$env.get('SOME_ENV_VAR', 'default value');
this.$env.set('key', 'val');
this.$env.set({key: 'val', key2: 'val2'});
~~~

@@ -41,4 +52,5 @@

## Note
As a side note, it's generally not a good idea to commit the `env.js` file. It's best to keep an `example.env.js` file that is committed instead.

@@ -1,28 +0,47 @@

/*
https://github.com/websanova/vue-env
rob@websanova.com
Version 0.1.1
*/
module.exports = (function () {
function Env(params) {
if ( ! params) {
try {
params = require('../../env.js');
function _set(params, key, val) {
var i;
if ( ! key) { return; }
params = params || {};
if (typeof key === 'object') {
for (i in key) {
params[i] = key[i];
}
}
catch(e) {
params = {};
else {
params[key] = val;
}
return params;
}
this.params = params;
}
function Env(env, conf) {
if ( ! env) {
try {
env = require('../../env.js');
}
catch(e) {
env = {};
}
}
Env.prototype.get = function (key, def) {
return this.params[key] || def;
}
this.params = _set(env, conf);
}
function install(Vue, params) {
Vue.prototype.$env = new Env(params);
}
Env.prototype.get = function (key, def) {
return this.params[key] || def;
};
module.exports = install;
Env.prototype.set = function (key, val) {
this.params = _set(this.params, key, val);
};
return function install(Vue, env, conf) {
Vue.prototype.$env = new Env(env, conf);
}
})();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc