open-index/open-npm huggingface dataset:
npm package: @jcoreio/kexec
Description: Replace your Node.js process with another process. Like Ruby exec.
Author: JP Richardson
Latest version: 4.0.0

Node.js - kexec
===============

[![npm Package](https://img.shields.io/npm/v/kexec.svg?style=flat-square)](https://www.npmjs.org/package/kexec)
[![build status](https://api.travis-ci.org/jprichardson/node-kexec.svg)](http://travis-ci.org/jprichardson/node-kexec)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

This module causes your current Node.js process to be replaced by the process invoked by the parameter of this function. It's like the Ruby exec function. It currently does not work on Windows.

Fully compatible with Node.js version v0.10 and v0.11.


Usage
-----

```js
var kexec = require('kexec')

kexec('top') //your process now becomes top, can also accept parameters in one string
```

```javascript
var kexec = require('kexec')

kexec('du', [ '-sh', '/etc/fstab' ]) //your process now becomes du, with the arguments indicated
```


Details
-------

`kexec` can be called in either of two ways, as indicated by the examples, above.

With one argument `arg`, that argument must be a string.  The resulting system
call is:

    execvp("/bin/sh", [ "/bin/sh", "-c", arg, 0 ]);

With two arguments, the first (`cmd`) must be a string, and the second (`args`) an array of strings.  The resulting
system call is:

    execvp(cmd, [ cmd, args[0], args[1], ..., 0 ]);

In the first case, the command is subject to shell parsing, and shell meta
characters retain their special meanings.  In the second case, the arguments
are passed directly to `execvp`, without an intervening shell.


License
-------

(The MIT License)

Copyright (c) 2011-2015 JP Richardson
npm package: @jcoreio/mutate
Description: a few immutable.js-like mutation functions for plain objects
Author: Andy Edwards
Latest version: 2.0.0

# @jcoreio/mutate

[![Build Status](https://travis-ci.org/jcoreio/mutate.svg?branch=master)](https://travis-ci.org/jcoreio/mutate)
[![Coverage Status](https://codecov.io/gh/jcoreio/mutate/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/mutate)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

a few immutable.js-like mutation functions for plain objects

Beware of using Ramda.js! [It always returns a new object, even if nothing changed!](https://github.com/ramda/ramda/issues/2429)

# Usage

```sh
pnpm install --save @jcoreio/mutate
```

# API

## `setIn(obj: any, path: Iterable<any>, newValue: any): any`

```js
const { setIn } = require('@jcoreio/mutate')
```

Works just like [`setIn` from Immutable.js](https://facebook.github.io/immutable-js/docs/#/setIn)
but operates on nested JS Objects and Arrays.

## `updateIn(obj: any, path: Iterable<any>, [notSetValue: any], updater: (value: any) => any): any`

```js
const { updateIn } = require('@jcoreio/mutate')
```

Works just like [`updateIn` from Immutable.js](https://facebook.github.io/immutable-js/docs/#/setIn)
but operates on nested JS Objects and Arrays.
npm package: @jcoreio/poll
Description: handy promised-based polling API
Author: Andy Edwards
Latest version: 3.0.2

# poll

[![Build Status](https://travis-ci.org/jcoreio/poll.svg?branch=master)](https://travis-ci.org/jcoreio/poll)
[![Coverage Status](https://codecov.io/gh/jcoreio/poll/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/poll)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

yet another promise-based poller (I didn't like the API design of others out there)

## Example

```sh
npm install --save @jcoreio/poll
```

```js
const poll = require('@jcoreio/poll')
const superagent = require('superagent')

poll(() => superagent.get('http://google.com'), 1000)
  .timeout(30000)
  .then(() => console.log("You're connected to the internet!"))
```

## `poll(fn, interval, [options])`

Begins calling `fn` every `interval` milliseconds until the condition passes
(which defaults to `fn` didn't throw an `Error` or return a rejected `Promise`).

Returns a `Promise` that resolves when polling finishes or fails, which may be:

- when `fn` calls the `pass` method provided to it
- when `fn` calls the `fail` method provided to it
- when `fn` returns/resolves to a value or throws/rejects with an `Error` that
  passes the condition
- when a timeout is specified and `poll` times out waiting for any of the above

`fn` will be called with a context object:

```js
{
  attemptNumber: number, // the number of this call (starting from 0)
  elapsedTime: number, // the number of milliseconds since polling started
  pass: (value: any) => void, // makes `poll` resolve immediately with this value
  fail: (error: Error) => void, // makes `poll` reject immediately with this Error
}
```

You can change the condition by calling `.until` on the returned `Promise`:

```js
poll(...).until((error, result) => result > 3)
```

`error` will be the `Error` from the last call to `fn` (if it rejected or threw)
and `result` will be the value it resolved to or returned otherwise.

You can specify a timeout (in milliseconds) by calling `.timeout` on the returned `Promise`:

```js
poll(...).timeout(30000) // time out after 30 seconds
```

If you call `.noWrapError()` on the returned `Promise`, it won't wrap rejection errors.
npm package: @jcoreio/react-use-measure
Description: my personal skeleton for React library NPM packages with Karma tests
Author: Andy Edwards
Latest version: 1.2.0

# @jcoreio/react-use-measure

[![CircleCI](https://circleci.com/gh/jcoreio/react-use-measure.svg?style=svg)](https://circleci.com/gh/jcoreio/react-use-measure)
[![Coverage Status](https://codecov.io/gh/jcoreio/react-use-measure/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/react-use-measure)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/es2015-library-skeleton.svg)](https://badge.fury.io/js/es2015-library-skeleton)

React hook for performing DOM measurements. Uses `resize-observer-polyfill` if necessary.

# Usage

```js
import * as React from 'react'
import useMeasure, { getBoundingContentRect } from 'react-use-measure'

const MyComp = () => {
  const [ref, bounds] = useMeasure(getBoundingContentRect)

  return (
    <div ref={ref}>
      My width is: {bounds?.width}
      My height is: {bounds?.height}
    </div>
  )
}
```

# `useMeasure<E extends Element, M>(measureFn, options)`

```ts
declare function useMeasure<E extends Element, M>(
  measure: (element: E) => M,
  options?: {
    key?: string | number | null
    deactivate?: boolean
    throttle?: number
  }
): [(element: E | null) => any, M | null | undefined, { remeasure: () => void }]
```

## `measureFn` (`(el: E) => M`, **required**)

The function to perform the DOM measurements you want.

`@jcoreio/react-use-measure` exports `getBoundingClientRect` and `getOffsetRect` that you can use.

## `options.key` (`string | number`, **optional**)

A key for the measurement. Change the key if you want to reset the measurement for any reason; it will
be reset to `null` until the next time `measureFn` is called.

## `options.throttle` (`number`, **optional**, default: `100`)

Wait time to throttle calls to `measureFn`.

## `options.deactivate` (`boolean`, **optional**, default: `true`)

If `true`, will disable the `ResizeObserver`.

## Returns

An array with three elements:

- `measureRef` - pass this as the `ref` to the element you want to measure
- `bounds` - the most recent measaurement returned by `measureFn` (may be `null`)
- `api` - an object with the following properties:
  - `remeasure` - call this to force remeasurement
npm package: @jcoreio/redis-subscriber
Description: subscribe specific callbacks to specific channels on the same redis client
Author: Andy Edwards
Latest version: 1.0.6

# redis-subscriber

[![Build Status](https://travis-ci.org/jcoreio/redis-subscriber.svg?branch=master)](https://travis-ci.org/jcoreio/redis-subscriber)
[![Coverage Status](https://coveralls.io/repos/github/jcoreio/redis-subscriber/badge.svg?branch=master)](https://coveralls.io/github/jcoreio/redis-subscriber?branch=master)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

Subscribe specific callbacks to specific channels on the same redis client

## Usage

```js
import redis from 'redis'
import RedisSubscriber from '@jcoreio/redis-subscriber'

const client = redis.createClient()
const subscriber = new RedisSubscriber(client)
```

### Subscribing
```js
subscriber.subscribe('foo', (channel, message) => ...)
subscriber.psubscribe('foo/*', (pattern, channel, message) => ...)
```

### Unsubscribing
There are two ways to unsubscribe:
* call `unsubscribe` or `punsubscribe`
```js
const onMessage = (channel, message) => ...
const onPMessage = (pattern, channel, message) => ...
subscriber.subscribe('foo', onMessage)
subscriber.psubscribe('foo/*', onPMessage)
...
subscriber.unsubscribe('foo', onMessage)
subscriber.unsubscribe('foo/*', onPMessage)
```
* call the function returned by `subscribe` or `psubscribe`
```js
const unsubscribe = subscriber.subscribe('foo', onMessage)
unsubscribe()
```
```js
const unsubscribe = subscriber.psubscribe('foo/*', onPMessage)
unsubscribe()
```

### `parseMessage` option

Parse all messages as JSON before sending them to callbacks:

```js
const subscriber = new RedisSubscriber(client, {parseMessage: JSON.parse})
```
npm package: @jcoreio/require-env
Description: get value of an environment variable; throw if undefined or empty string
Author: Andy Edwards
Latest version: 1.1.89

# @jcoreio/require-env

[![CircleCI](https://circleci.com/gh/jcoreio/require-env.svg?style=svg)](https://circleci.com/gh/jcoreio/require-env)
[![Coverage Status](https://codecov.io/gh/jcoreio/require-env/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/require-env)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/%40jcoreio%2Frequire-env.svg)](https://badge.fury.io/js/%40jcoreio%2Frequire-env)

A simple function that returns the value of an environment variable, but **throws if it's not a non-empty string**.
Logs the entire environment to `console.error` to aid debugging.
Flow type defs included.

## Usage

```sh
npm install --save @jcoreio/require-env
```

```js
var requireEnv = require('require-env')

var FOO = requireEnv('FOO')
// now you can be sure that FOO is a non-empty string, and Flow will trust that it is too.
```

By default it looks in `process.env`, but you can override this by passing the environment
hash as the second argument:

```js
var environment = { ...process.env, ...require('./defaultEnv.js') }
var FOO = requireEnv('FOO', environment)
```

## See also

- [`defaultenv`](https://github.com/jcoreio/defaultenv) - fantastic CLI/Node API for loading default environment variable values

## Error messages

In the past `Error`s thrown had all environment variables in their `message`s.
I've since realized this was a huge security risk when error messages are sent
from server to client. Now the message and environment variables are printed to
`console.error`. You can customize this by monkeypatching the
`require('@jcoreio/require-env').logError` function.
npm package: @jcoreio/semantic-release-monorepo
Description: files
Author: Andy Edwards
Latest version: 1.0.1

# @jcoreio/semantic-release-monorepo

[![CircleCI](https://circleci.com/gh/jcoreio/semantic-release-monorepo.svg?style=svg)](https://circleci.com/gh/jcoreio/semantic-release-monorepo)
[![Coverage Status](https://codecov.io/gh/jcoreio/semantic-release-monorepo/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/semantic-release-monorepo)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/%40jcoreio%2Fsemantic-release-monorepo.svg)](https://badge.fury.io/js/%40jcoreio%2Fsemantic-release-monorepo)

`semantic-release-monorepo` determines which commits apply to a given packages by seeing if they touched files in that package.

This fork instead uses only the commit messages to determine which packages are affected. In accordance with `cz-lerna-changelog`,
the fork in this folder looks for a line in the commit message like

```
affects: @jcoreio/license-api, @jcoreio/license-api-backend
```

This is for special cases where the packages to publish are built by scripts in such a way that looking at which files were affected by a commit can't always determine which packages were actually affected.

# Usage

Run `semantic-release` in the **root of a monorepo package** and apply `@jcoreio/semantic-release-monorepo` via the [`extends`](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#extends) option.

On the command line:

```bash
$ npm run semantic-release -e @jcoreio/semantic-release-monorepo
```

Or in the [release config](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration-file):

```json
{
  "extends": "@jcoreio/semantic-release-monorepo"
}
```
npm package: @jcoreio/sparkplug-payload
Description: routines for encoding and decoding sparkplug payloads
Author: Andy Edwards
Latest version: 3.1.3

# @jcoreio/sparkplug-payload

[![CircleCI](https://circleci.com/gh/jcoreio/sparkplug-payload.svg?style=svg)](https://circleci.com/gh/jcoreio/sparkplug-payload)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/%40jcoreio%2Fsparkplug-payload.svg)](https://badge.fury.io/js/%40jcoreio%2Fsparkplug-payload)

A library that provides tools for encoding and decoding payload objects using
the Sparkplug Google Protocol Buffer Schema described in the Sparkplug
Specification from Cirrus Link Solutions.

https://s3.amazonaws.com/cirrus-link-com/Sparkplug+Topic+Namespace+and+State+ManagementV2.1+Apendix++Payload+B+format.pdf

**Not a drop-in replacement for the original `sparkplug-payload` package; require paths have changed.**

## Installation

```sh
npm install --save @jcoreio/sparkplug-payload
```

### Encoding a payload

Here is a code example of encoding a payload:

```javascript
var sparkplug = require('@jcoreio/sparkplug-payload/spBv1.0'),
  payload = {
    timestamp: new Date().getTime(),
    metrics: [
      {
        name: 'intMetric',
        value: 1,
        type: 'Int32',
      },
    ],
  },
  encoded = sparkplug.encodePayload(payload)
```

### Decoding a payload

Here is a code example of decoding an encoded payload:

```javascript
var decoded = sparkplug.decodePayload(encoded)
```

## License

Copyright (c) 2017 Cirrus Link Solutions

All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

Contributors: Cirrus Link Solutions, JCore Systems
npm package: @jcoreio/tar-bundler
Description: Generate tar.bz2 bundles
Author: Jason McLaurin
Latest version: 1.1.0

# tar-bundler

[![CircleCI](https://circleci.com/gh/jcoreio/tar-bundler.svg?style=svg)](https://circleci.com/gh/jcoreio/tar-bundler)
[![Coverage Status](https://codecov.io/gh/jcoreio/tar-bundler/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/tar-bundler)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

Generate tar.bz bundles using system bzip2 if possible, or self-contained bzip2 if needed

## Installation

```sh
yarn add @jcoreio/tar-bundler
```

## Usage

```js
const { bundle } = require('@jcoreio/tar-bundler')

async function makeBundle() {
  await bundle({ srcDir: 'myDir', destFile: 'archive.tar.bz2' })
  console.log('successfully saved archive')
}
```
npm package: @jcoreio/toolchain-aws-lambda
Description: AWS Lambda function build toolchain
Author: Andy Edwards
Latest version: 5.10.5

# @jcoreio/toolchain-aws-lambda

This project deploys an AWS Lambda Function from JS or TS source.

## Features

- Supports `.env` file, you can put AWS credentials, `AWS_SDK_LOAD_CONFIG=1`, `AWS_REGION` etc in `.env` if you like
- Adds the `tc deploy` script, which deploys to AWS
- Uses `pack-lambda` to stream the source to S3, supporting `pnpm`
- If you use `@jcoreio/toolchain-semantic-release`, will deploy in CI

## Conventions

The project must contain `scripts/cloudFormationTemplate.js` (or `.ts` if you're using `@jcoreio/toolchain-typescript`)
that exports the following:

- `StackName` (optional) - the name for the CloudFormation Stack (defaults to the Lambda FunctionName)
- `Template` - the CloudFormation template
- `Parameters` (optional) - the parameters for the template
- `Capabilities` - the capabilities to use when deploying the stack
- `Tags` (options) - the tags for the CloudFormation Stack

The `Template` must contain one `AWS::Lambda::Function` or `AWS::Serverless::Function`. It will provide defaults
for the following properties, so they are optional:

- `Description`: defaults to the `description` in `package.json`
- `CodeUri`: defaults the `Bucket` to the AWS Account, and the
  `Key` to something based upon the `name` in `package.json`
- `Handler`: defaults to the `handler` export in the `main` file
  in `package.json`
- `Runtime`: defaults to `nodejs20.x`
- `FunctionName`: defaults to something based upon the `name` in `package.json`
npm package: @jcoreio/typed-event-emitter
Description: fully type-safe EventEmitter flow declaration
Author: Andy Edwards
Latest version: 1.3.1

# @jcoreio/typed-event-emitter

[![CircleCI](https://circleci.com/gh/jcoreio/typed-event-emitter.svg?style=svg)](https://circleci.com/gh/jcoreio/typed-event-emitter)
[![Coverage Status](https://codecov.io/gh/jcoreio/typed-event-emitter/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/typed-event-emitter)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/%40jcoreio%2Ftyped-event-emitter.svg)](https://badge.fury.io/js/%40jcoreio%2Ftyped-event-emitter)

fully type-safe `EventEmitter` flow declaration

## Usage

```sh
npm install --save @jcoreio/typed-event-emitter
```

```js
// @flow

import EventEmitter from '@jcoreio/typed-event-emitter'

function createEmitter(): EventEmitter<{
  eventA: [string],
  eventB: [string, number],
}>

const emitter = createEmitter()

emitter.on('eventA', (foo: string) => {...})
emitter.on('eventB', (foo: string, bar: number) => {...})

emitter.emit('eventA', 'foo')
emitter.emit('eventB', 'foo', 1)
```