1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
-
- 'use strict';
-
- var _ = require('underscore');
-
-
- var Namespace = module.exports = function Namespace(options) {
- _.extend(this, options);
- };
-
-
- Namespace.prototype.isset = function (key) {
- return _.has(this, key);
- };
-
-
- Namespace.prototype.set = function (key, value) {
- if (typeof (key) === 'object') {
- _.extend(this, key);
- } else {
- this[key] = value;
- }
- return this;
- };
-
-
- Namespace.prototype.get = function (key, defaultValue) {
- return !this[key] ? defaultValue: this[key];
- };
-
-
- Namespace.prototype.unset = function (key, defaultValue) {
- var value = this[key];
- if (value !== null) {
- delete this[key];
- return value;
- } else {
- return defaultValue;
- }
- };
|