"use strict";

function _scope() {
  const data = require("../../../scope");

  _scope = function () {
    return data;
  };

  return data;
}

function set(key, value) {
  return (0, _scope().loadScope)().then(scope => {
    scope.scopeJson.set(key, value);
    return scope.scopeJson.write(process.cwd()).then(() => ({
      key,
      value
    }));
  });
}

function get(key) {
  return (0, _scope().loadScope)().then(scope => scope.scopeJson.get(key));
}

function del(key) {
  return (0, _scope().loadScope)().then(scope => {
    scope.scopeJson.del(key);
    return scope.scopeJson.write(process.cwd());
  });
}

function list() {
  return (0, _scope().loadScope)().then(scope => scope.scopeJson.toPlainObject());
}

module.exports = {
  set,
  get,
  del,
  list
};