@zoodogood/utils 0.9.6 → 1.0.1

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/lib/index.js CHANGED
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./primitives/mod.js"), exports);
18
- __exportStar(require("./objectives/mod.js"), exports);
1
+ export * from './primitives/mod.js';
2
+ export * from './objectives/mod.js';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const child_process_1 = require("child_process");
16
- const events_1 = __importDefault(require("events"));
17
- exports.default = ({ root, logger = false }) => {
10
+ import { spawn } from "child_process";
11
+ import EventsEmitter from "events";
12
+ export default ({ root, logger = false }) => {
18
13
  // Solve problem: https://stackoverflow.com/questions/43230346/error-spawn-npm-enoent
19
14
  const _npm = process.platform === "win32" ? "npm.cmd" : "npm";
20
15
  const EventsCallbacks = [
@@ -72,10 +67,10 @@ exports.default = ({ root, logger = false }) => {
72
67
  ];
73
68
  const info = (string) => __awaiter(void 0, void 0, void 0, function* () { return console.info(`\x1b[1m${string}\x1b[22m`); });
74
69
  const run = (command, params) => __awaiter(void 0, void 0, void 0, function* () {
75
- const child = (0, child_process_1.spawn)(command, params, { cwd: root });
70
+ const child = spawn(command, params, { cwd: root });
76
71
  const exitData = { resolve: null, reject: null };
77
72
  const promise = new Promise((resolve, reject) => Object.assign(exitData, { resolve, reject }));
78
- const emitter = new events_1.default();
73
+ const emitter = new EventsEmitter();
79
74
  const outString = "";
80
75
  const events = Object.fromEntries(EventsCallbacks.map(({ callback, key }) => [
81
76
  key,
@@ -1 +1 @@
1
- export { default as getChildProcessUtils } from './getChildProcessUtils';
1
+ export { default as getChildProcessUtils } from './getChildProcessUtils.js';
package/lib/nodejs/mod.js CHANGED
@@ -1,8 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getChildProcessUtils = void 0;
7
- var getChildProcessUtils_1 = require("./getChildProcessUtils");
8
- Object.defineProperty(exports, "getChildProcessUtils", { enumerable: true, get: function () { return __importDefault(getChildProcessUtils_1).default; } });
1
+ export { default as getChildProcessUtils } from './getChildProcessUtils.js';
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  interface ICustomCollectorOptions {
3
3
  target: Required<{
4
4
  removeListener: CallableFunction;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
2
  if (kind === "m") throw new TypeError("Private method is not writable");
4
3
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -11,8 +10,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
11
  };
13
12
  var _CustomCollector_callback;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CustomCollector = void 0;
16
13
  class CustomCollector {
17
14
  constructor({ target, event, filter, time = 0 }) {
18
15
  _CustomCollector_callback.set(this, void 0);
@@ -58,5 +55,5 @@ class CustomCollector {
58
55
  this.timeoutId = setTimeout(callback, ms);
59
56
  }
60
57
  }
61
- exports.CustomCollector = CustomCollector;
62
58
  _CustomCollector_callback = new WeakMap();
59
+ export { CustomCollector };
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GlitchText = void 0;
4
- const getRandomValue_1 = require("./getRandomValue");
1
+ import { getRandomValue } from "./getRandomValue.js";
5
2
  class GlitchText {
6
3
  constructor(from = "", to = "hello, world", { step = 15, random = false, maximum = 100 } = {}) {
7
4
  this.from = from;
@@ -21,7 +18,7 @@ class GlitchText {
21
18
  word.pop();
22
19
  if (word.length < target.length)
23
20
  word.push(String.fromCharCode(~~(Math.random() * 50)));
24
- word.forEach((_, index, array) => array[index] = String.fromCharCode((0, getRandomValue_1.getRandomValue)({ min: MIN, max: MAX })));
21
+ word.forEach((_, index, array) => array[index] = String.fromCharCode(getRandomValue({ min: MIN, max: MAX })));
25
22
  yield word.join("");
26
23
  }
27
24
  if (this.maximum)
@@ -50,4 +47,4 @@ class GlitchText {
50
47
  return;
51
48
  }
52
49
  }
53
- exports.GlitchText = GlitchText;
50
+ export { GlitchText };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRandomValue = void 0;
4
1
  function getRandomValue({ min = 0, max, round = true }) {
5
2
  let value = Math.random() * (max - min + Number(round)) + min;
6
3
  if (round) {
@@ -8,4 +5,4 @@ function getRandomValue({ min = 0, max, round = true }) {
8
5
  }
9
6
  return value;
10
7
  }
11
- exports.getRandomValue = getRandomValue;
8
+ export { getRandomValue };
@@ -1,26 +1,9 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.omit = void 0;
18
- __exportStar(require("./CustomCollector.js"), exports);
19
- __exportStar(require("./GlitchText.js"), exports);
20
- __exportStar(require("./getRandomValue.js"), exports);
1
+ export * from './CustomCollector.js';
2
+ export * from './GlitchText.js';
3
+ export * from './getRandomValue.js';
21
4
  function omit(object, filter) {
22
5
  const entries = Object.entries(object)
23
6
  .filter(([key, value], i) => filter(key, value, i));
24
7
  return Object.fromEntries(entries);
25
8
  }
26
- exports.omit = omit;
9
+ export { omit };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ending = void 0;
4
1
  function ending(quantity = 0, base, multiple, alone, double, options = {}) {
5
2
  if (isNaN(quantity))
6
3
  return NaN;
@@ -11,4 +8,4 @@ function ending(quantity = 0, base, multiple, alone, double, options = {}) {
11
8
  const input = options.unite(quantity, word);
12
9
  return input;
13
10
  }
14
- exports.ending = ending;
11
+ export { ending };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@zoodogood/utils",
3
- "version": "0.9.6",
3
+ "type": "module",
4
+ "version": "1.0.1",
4
5
  "description": "",
5
6
  "main": "lib/index.js",
6
7
  "types": "lib/index.d.ts",
@@ -11,26 +12,11 @@
11
12
  },
12
13
  "typings": "lib/index",
13
14
  "exports": {
14
- ".": {
15
- "default": "./lib/index.js",
16
- "types": "./lib/index.d.ts"
17
- },
18
- "./primitives": {
19
- "default": "./lib/primitives/mod.js",
20
- "types": "./lib/primitives/mod.d.ts"
21
- },
22
- "./objectives": {
23
- "default": "./lib/objectives/mod.js",
24
- "types": "./lib/objectives/mod.d.ts"
25
- },
26
- "./discordjs": {
27
- "default": "./lib/discordjs/mod.js",
28
- "types": "./lib/discordjs/mod.d.ts"
29
- },
30
- "./nodejs": {
31
- "default": "./lib/nodejs/mod.js",
32
- "types": "./lib/nodejs/mod.d.ts"
33
- }
15
+ ".": "./lib/mod.js",
16
+ "./primitives": "./lib/primitives/mod.js",
17
+ "./objectives": "./lib/objectives/mod.js",
18
+ "./discordjs": "./lib/discordjs/mod.js",
19
+ "./nodejs": "./lib/nodejs/mod.js"
34
20
  },
35
21
  "repository": {
36
22
  "type": "git",
@@ -50,5 +36,14 @@
50
36
  },
51
37
  "files": [
52
38
  "/lib/**/*"
53
- ]
39
+ ],
40
+ "typesVersions": {
41
+ ">=4.2": {
42
+ "*": ["lib/index.d.ts"],
43
+ "primitives": ["lib/primitives/mod.d.ts"],
44
+ "objectives": ["lib/objectives/mod.d.ts"],
45
+ "discordjs": ["lib/discordjs/mod.d.ts"],
46
+ "nodejs": ["lib/nodejs/mod.d.ts"]
47
+ }
48
+ }
54
49
  }