horae-configure 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/horae.js +1 -1
- package/package.json +2 -2
package/dist/horae.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as t}from"module";var n,e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n)},r={};e.d(r,{d:()=>s}),function(t){t.JSON="json"}(n||(n={}));const o=t(import.meta.url)("fs");var i=e.n(o),a=function(t){return t.split(".").filter(Boolean)};function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function f(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,n){if(t){if("string"==typeof t)return u(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?u(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(c)throw i}}}}function u(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function l(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,o=function(t,n){if("object"!==c(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!==c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===c(o)?o:String(o)),r)}var o}var s=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JSON;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:{name:"config"}}),this.config.name=e,this.config.type=r,this.initialize()}var e,r;return e=t,(r=[{key:"initialize",value:function(){var t="".concat(this.config.name,".").concat(this.config.type);if(i().existsSync(t)){var n=JSON.parse(i().readFileSync("".concat(this.config.name,".").concat(this.config.type),"utf8"));this.config.data=n}else this.config.data={}}},{key:"set",value:function(t,n){var e=a(t),r=Object.assign({},this.config.data);e.reduce((function(t,r){return r===e[e.length-1]?t[r]=n:t[r]||(t[r]={}),t[r]}),r),this.config.data=r}},{key:"get",value:function(t){if(this.config.data){var n,e=this.config.data,r=f(a(t));try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!e.hasOwnProperty(o))return;e=e[o]}}catch(t){r.e(t)}finally{r.f()}return e}}},{key:"has",value:function(t){if(!this.config.data)return!1;var n,e=this.config.data,r=f(a(t));try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!e.hasOwnProperty(o))return!1;e=e[o]}}catch(t){r.e(t)}finally{r.f()}return!0}},{key:"save",value:function(){var t="".concat(this.config.name,".").concat(this.config.type);i().writeFileSync(t,JSON.stringify(this.config.data,null,2))}}])&&l(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),y=r.d;export{y as Horae};
|