@graffy/common 0.15.25-alpha.6 → 0.15.25

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.
Files changed (3) hide show
  1. package/index.cjs +11 -2
  2. package/index.mjs +10 -1
  3. package/package.json +2 -3
package/index.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const nonSecure = require("nanoid/non-secure");
4
3
  const mergeIterators = require("merge-async-iterators");
5
4
  const stream = require("@graffy/stream");
6
5
  const isEqual = require("lodash/isEqual.js");
@@ -419,7 +418,17 @@ function splitRef($ref) {
419
418
  return [];
420
419
  return splitArgs(tail);
421
420
  }
422
- const id = nonSecure.customAlphabet(alpha, 20);
421
+ let customAlphabet = (alphabet, defaultSize = 21) => {
422
+ return (size = defaultSize) => {
423
+ let id2 = "";
424
+ let i = size;
425
+ while (i--) {
426
+ id2 += alphabet[Math.random() * alphabet.length | 0];
427
+ }
428
+ return id2;
429
+ };
430
+ };
431
+ const id = customAlphabet(alpha, 20);
423
432
  function findFirst(children, target, first, last) {
424
433
  return find(
425
434
  children,
package/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { customAlphabet } from "nanoid/non-secure";
2
1
  import mergeIterators from "merge-async-iterators";
3
2
  import { makeStream } from "@graffy/stream";
4
3
  import isEqual from "lodash/isEqual.js";
@@ -414,6 +413,16 @@ function splitRef($ref) {
414
413
  return [];
415
414
  return splitArgs(tail);
416
415
  }
416
+ let customAlphabet = (alphabet, defaultSize = 21) => {
417
+ return (size = defaultSize) => {
418
+ let id2 = "";
419
+ let i = size;
420
+ while (i--) {
421
+ id2 += alphabet[Math.random() * alphabet.length | 0];
422
+ }
423
+ return id2;
424
+ };
425
+ };
417
426
  const id = customAlphabet(alpha, 20);
418
427
  function findFirst(children, target, first, last) {
419
428
  return find(
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/common",
3
3
  "description": "Common libraries that used by various Graffy modules.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.15.25-alpha.6",
5
+ "version": "0.15.25",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -17,8 +17,7 @@
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
19
  "lodash": "^4.17.19",
20
- "nanoid": "^4.0.0",
21
20
  "merge-async-iterators": "^0.2.1",
22
- "@graffy/stream": "0.15.25-alpha.6"
21
+ "@graffy/stream": "0.15.25"
23
22
  }
24
23
  }