open-index/open-npm huggingface dataset:
npm package: @opsimathically/asyncsleep
Description: Simulate sleep() behavior using async/await/promises/setTimeout.  Functions available for sleeping ms/sec/min/hour/day/month/year.
Author: Jason Medeiros
Latest version: 1.0.0

# asyncsleep

While javascript does not actually provide "sleep" capabilities such as those found in C, there are times, such
as during debugging or unit testing, where waiting for an arbitrary timeout/doing nothing, could be useful. These
utility functions simply allow you to wait for a promise that resolves a after a timeout, effectively creating
a simulated sleep period.

## Install

```bash
npm install @opsimathically/asyncsleep
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

```typescript
import {
  asyncSleepMs,
  asyncSleepSec,
  asyncSleepMin,
  asyncSleepHour,
  asyncSleepDay,
  asyncSleepApproxMonth,
  asyncSleepApproxYear
} from '@opsimathically/asyncsleep;';

(async function () {
  // All of these will sleep for approximately 1 second each.  Running all of these will elapse
  // about 7 seconds of wait time total.
  await asyncSleepMs(1000);
  await asyncSleepSec(1);
  await asyncSleepMin(1 / 60);
  await asyncSleepHour(1 / 60 / 60);
  await asyncSleepDay(1 / 60 / 60 / 24);
  await asyncSleepApproxMonth(1 / 60 / 60 / 24 / 30);
  await asyncSleepApproxYear(1 / 60 / 60 / 24 / 30 / 365);
})();
```
npm package: @opsimathically/decycle
Description: One way, fast and simple object decycling with no retrocycling/reference tracking.
Author: Jason Medeiros
Latest version: 1.0.2

# decycle

Removes circular references from an object in a one-way direction. Similar projects often track references so that an
object can be retrocycled, which in-turn adds compute overhead. This project aims to simply not provide that functionality so
that the decycling speed and functionality can be prioritized.

## Install

```bash
npm install @opsimathically/decycle
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

```typescript
import { decycle, decycleStrip } from '@opsimathically/decycle';

(async function () {
  // Create circular object
  const obj_1 = { a: 1, b: 2, c: 3 };
  const obj_2 = { d: 4 };
  const arr_1 = [1, 2, 3, 4];
  const obj_with_circular_references = {
    internal_1: {
      test1: obj_1,
      internal_2: [1, 6, obj_2],
      testarr1: arr_1
    },
    test1: obj_1,
    test2: obj_2,
    test3: arr_1
  };

  // decycle preserving markers
  const decycled_obj_with_markers = decycle(obj_with_circular_references);

  // decycle stripping markers
  const decycled_obj_with_stripped_circulars = decycleStrip(
    obj_with_circular_references
  );

  /*
  Decycled Object With Markers:
  {
    internal_1: {
      test1: { a: 1, b: 2, c: 3 },
      internal_2: [ 1, 6, [Object] ],
      testarr1: [ 1, 2, 3, 4 ]
    },
    test1: '[decycled]',
    test2: '[decycled]',
    test3: '[decycled]'
  }

  Decycled Object With Stripped Circulars:
  {
    internal_1: {
      test1: { a: 1, b: 2, c: 3 },
      internal_2: [ 1, 6, [Object] ],
      testarr1: [ 1, 2, 3, 4 ]
    }
  }
  */
})();
```
npm package: @opsimathically/deferred
Description: Utility classes for working with the asynchronous deferral pattern.
Author: Jason Medeiros
Latest version: 1.0.1

# deferred

Utility classes for working with the asynchronous deferral pattern. Primarily used in conjunction
with asynchronous/callback oriented code that doesn't match promisify callback signatures. It's
generally useful for working with arbitrary unusual callback based apis. The Deferred class is
a standalone promise/resolve/reject set, whereas the DeferredMap lets you create a map containing
an arbitrarily created number of deferrals. The advantage of using the map version is that you
can easily track and resolve/reject all waiting deferrals when desired rather than having to
track them all individually.

# Install

npm install @opsimathically/deferred

# Usage

```typescript
import { Deferred, DeferredMap } from '@opsimathically/deferred';

(async function () {
  // create new deferral map
  const deferred_map = new DeferredMap();

  // create and track a single deferral
  const deferral: Deferred = deferred_map.deferred();

  // wait 500ms before resolving the deferral
  setTimeout(function () {
    deferral.resolve(true);
  }, 500);

  // after the timeout, this promise will resolve with the desired result (true)
  let deferred_result = await deferral.promise;
  console.log(`deferred_result after 500ms wait: ${deferred_result}`);

  // create 500 deferrals
  for (let idx = 0; idx < 500; idx++) deferred_map.deferred();

  // resolve all promises with value (true)
  console.log(
    `Total entries in map before resolving them: ${deferred_map.size}`
  );
  deferred_map.resolveAll(true);
  console.log(
    `Total entries in map after resolving them: ${deferred_map.size}`
  );
})();
```
npm package: @opsimathically/emptytools
Description: Utilities for determining the emptiness of values.
Author: Jason Medeiros
Latest version: 1.0.1

# emptytools

This package provides utility functions for determining the "emptiness" of
values wherein "empty" is defined below. The purpose of this is for runtime
validation of data to quickly determine if a value falls outside of expected
"presentness." This is a basic, but foundationally useful bit of code that can
be utilized to quickly determine the present/empty state of a value.

```typescript
/*
  Definition of "empty":
    zero length buffer
    undefined
    null
    zero length array
    zero length string
    object with no keys
    set with no entries
    map with no entries
    date with invalid/unparsable date

  Empty is NOT 0 or false, wherein these are both considered valid non-empty values.
*/
```

## Install

```bash
npm install @opsimathically/emptytools
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

```typescript
import {
  isEmpty,
  isNotEmpty,
  valuesAreEmpty,
  valuesAreNotEmpty
} from '@opsimathically/emptytools';

(async function () {
  // true
  isEmpty(undefined);
  isEmpty(null);
  isEmpty(new Date(''));
  isEmpty(new Set());
  isEmpty(new Map());
  isEmpty(Buffer.alloc(0));
  isEmpty([]);
  isEmpty('');
  isEmpty({});

  // false
  isEmpty({ a: 1 });
  isEmpty(0);
  isEmpty(false);
  isEmpty([1, 2, 3]);

  // false
  isNotEmpty({});

  // true
  valuesAreEmpty([
    undefined,
    null,
    new Date(''),
    new Set(),
    new Map(),
    Buffer.alloc(0),
    [],
    '',
    {}
  ]);

  // true
  valuesAreNotEmpty([
    undefined,
    null,
    new Date(''),
    new Set(),
    new Map(),
    Buffer.alloc(0),
    [],
    '',
    { a: 1 } // not empty val
  ]);
})();
```
npm package: @opsimathically/garbage
Description: Build random objects full of garbage, any kind of garbage, in any way. Useful for for fuzz testing code at runtime to see if unexpected outcomes can occur. 
Author: Jason Medeiros
Latest version: 1.0.1

# garbage

Generate garbage. What is garbage? Garbage is anything. Just objects, errors, proxies, promises,
typed arrays, symbols, anything really that you'd want to sanity-test with. Feed garbage
to something and see how that-something behaves to fuzz out potential problems. Garbage depth
is random, content is random, it's all random garbage.

## Install

```bash
npm install @opsimathically/garbage
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

[See API Reference for documentation](https://github.com/opsimathically/garbage/blob/main/docs/)

[See unit tests for a usage example](https://github.com/opsimathically/garbage/blob/main/test/garbage.test.ts)

```typescript
import { generateRandomGarbage } from '@opsimathically/garbage';
const any_garbage: any = generateRandomGarbage();
console.log(any_garbage);
```
npm package: @opsimathically/objectsearch
Description: Recursively searches through runtime objects for keys and values, returning paths to found data. Supports a variety of search functionality, and is very useful for analyzing runtime data.
Author: Jason Medeiros
Latest version: 1.0.6

# objectsearch

Recursively, and deeply, searches through objects, and nested maps, symbols, and sets - executing
a callback on each key/val, giving you the opportunity to operate on what was found.  
Complex pathings are generated which can be used to access just about anything found later
during execution.

There are several "search" oriented packages on npm; the core difference in this one is its
thoroughness in search/path generation. For example, you can search for a value in an object
which is being used as a key within a map, get a path to it, and then operate on that
key object using the generated path. You can search for a nested key, within an object,
stored in a set, and do the same. You can search objects/sets/maps within object symbols,
and do the same.

Additionally, our search analyzer uses the [@opsimathically/whatis](https://www.npmjs.com/package/@opsimathically/whatis) package
on keys and values so that you can use whatis plugins, if desired, or if not, simply
have detailed information about what it is you're looking at. This makes it possible
to write a set of whatis plugins, load them into an ObjectSearch instance, and quickly and
easily identify and store matching data during searches, fitting almost any imaginable
object search need.

## Install

```bash
npm install @opsimathically/objectsearch
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

[See example code](https://github.com/opsimathically/objectsearch/blob/main/example/objectsearch.example.ts)

[See API Reference for documentation](https://github.com/opsimathically/objectsearch/blob/main/docs/)

[See unit tests for more direct usage examples](https://github.com/opsimathically/objectsearch/blob/main/test/objectsearch.test.ts)
npm package: @opsimathically/randomdatatools
Description: Various tools for working with/generating random data of various types, character sets, etc.
Author: Jason Medeiros
Latest version: 1.0.1

# randomdatatools

Tools for generating random data of various types. These tools were taken from
various fuzzer projects of mine, and consoldiated here for ease of use.

## Install

```bash
npm install @opsimathically/randomdatatools
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

[See API Reference for documentation](https://github.com/opsimathically/randomdatatools/blob/main/docs/)

[See unit tests for usage examples](https://github.com/opsimathically/randomdatatools/blob/main/test/randomdatatools.test.ts)

### APIs

- randomIntegerBetween
- randomNegativeIntegerBetween
- randomBinaryBufferBetween
- randomBinaryBuffer
- randomTimeBetween
- randomString
- randomStringStringBetweenLength
- randomHexString
- randomAlphabetString
- randomArrayOfAlphaStrings
- randomAlphabetStringBetweenLength
- randomAlphanumericString
- randomAlphanumericStringBetweenLength
- randomIPV4Address
- randomArrayOfIPV4Addresses
- randomizeValuesOfSummableArray
- randomGuid
- randomDoubleLengthGuid
npm package: @opsimathically/safejsonparse
Description: Parse untrusted JSON, avoiding potential prototype pollution/bad type issues.
Author: Jason Medeiros
Latest version: 1.0.0

# safejsonparse

This utility will attempt to parse json, and then run a secondary sanitizer to
detect and throw an error on encountering keys with potential prototype polluion, or invalid
value types.

## Install

```bash
npm install @opsimathically/safejsonparse
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

```typescript
import { safejsonparse } from '@opsimathically/safejsonparse;';

(async function () {
  // some json with a potentially insecure __proto__ pollution.
  const malicious_with_proto_json = `{
      "__proto__": {
        "polluted": true
      }
    }`;

  // this try/catch will throw any regular json parse error, but additionally will throw
  // if it detects constructor/prototype/__proto__ keys.
  try {
    safejsonparse(malicious_with_proto_json);
  } catch (err) {
    console.log('Detected invalid __proto__ key.');
  }
})();
```
npm package: @opsimathically/stringtools
Description: Basic foundational tools for working with and identifying strings.
Author: Jason Medeiros
Latest version: 1.0.1

# stringtools

These tools have been cannibalized from a number of my internal projects and have been consolidated
here. All functions exported work directly with strings, and are designed to provide some
arbitrary string behavior.

## Install

```bash
npm install @opsimathically/stringtools
```

## Building from source

This package is intended to be run via npm, but if you'd like to build from source,
clone this repo, enter directory, and run `npm install` for dev dependencies, then run
`npm run build`.

## Usage

[See API Reference for documentation](https://github.com/opsimathically/stringtools/blob/main/docs/)

[See unit tests for usage examples](https://github.com/opsimathically/stringtools/blob/main/test/stringtools.test.ts)

### APIs

- isString
- isAsciiPrintableString
- isAsciiPrintableSpaceAlphanumericSymbolsString
- isAlphaNumericUnderscoreSpaceString
- isAlphaNumericUnderscorePeriodString
- isAlphaNumericUnderscoreSpaceCommaString
- isAlphaNumericUnderscoreSpaceCommaPeriodString
- isAlphaNumericUnderscoreString
- isAlphaNumericUnderscoreDashString
- isAlphaNumericString
- isNumericString
- isAlphabetString
- isHexString
- findDisallowedCharactersInString
- splitOnFirstNonAsciiPrintableChar
- stripLeadingWhitespaceFromString
- removeFirstInstanceFromString
- removeRepeatingCharactersFromString
- rtrim
- ltrim
- isValidUUIDString
- isValidDoubleLengthUUIDString
- sortIntegerStringArray
- sortAndDeduplicateAlphanumericStringArray
- tokenizeString
- capitalizeWords
- stringToLowercaseUnderscore
- stringToNormalizedLowercaseNoSpecialChars
- stringToHexArray
- stringEndsWith
- stringEndsWithItemInArray
- stringStartsWith
- stringStartsWithItemInArray
- stringRemoveNewlines
- removeLastLineFromString
- removeCommonFrontPartsFromStringArray
- stringArrayToString
- splitStringByLength