Skip to content

Commit

Permalink
simplify api
Browse files Browse the repository at this point in the history
  • Loading branch information
rhalff committed Mar 6, 2015
1 parent f0833d2 commit 5ce0fe8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ function DotObject(seperator, override) {
this.override = override;
}

var dotDefault = new DotObject('.', false);
function wrap(method) {
return function() {
return dotDefault[method].apply(dotDefault, arguments);
};
}

DotObject.prototype._fill = function(a, obj, v, mod) {
var k = a.shift();

Expand Down Expand Up @@ -258,4 +265,12 @@ DotObject.prototype.set = function(path, val, obj, merge) {
}
};

DotObject.pick = wrap('pick');
DotObject.move = wrap('move');
DotObject.transfer = wrap('transfer');
DotObject.copy = wrap('copy');
DotObject.object = wrap('object');
DotObject.str = wrap('str');
DotObject.set = wrap('set');

module.exports = DotObject;

0 comments on commit 5ce0fe8

Please sign in to comment.