open-index/open-npm huggingface dataset:
npm package: @hutsoninc/data-scrubber
Description: Data validation and formatting utilities used by Hutson marketing team.
Author: AustinLeeGordon
Latest version: 2.0.0

# data-scrubber

[![Build Status](https://travis-ci.com/hutsoninc/data-scrubber.svg?branch=master)](https://travis-ci.com/hutsoninc/data-scrubber) [![Current npm package version](https://img.shields.io/npm/v/@hutsoninc/data-scrubber.svg)](https://www.npmjs.com/package/@hutsoninc/data-scrubber)

Data validation and formatting utilities used by Hutson marketing team.

## Usage

`npm install @hutsoninc/data-scrubber`

```js
const {
    scrubEmail,
    scrubHutsonBranch,
    scrubPhone,
    scrubState,
    scrubZip
} = require('@hutsoninc/data-scrubber');

scrubEmail('hello@me@mail.com');
// => ''

scrubHutsonBranch('hopkinsville');
// => 'Hopkinsville, KY'

scrubHutsonBranch(1);
// => 'Mayfield, KY'

scrubPhone('(123) 456-7890');
// => '1234567890'

scrubState('kentucky');
// => 'KY'

scrubZip('12345-6789');
// => '12345'
```

### API

Each method will validate and format the input, returning an empty string for invalid inputs or the formatted value otherwise.

#### scrubEmail

Converts input to lowercase string and returns it.

#### scrubHutsonBranch

Converts city name or store number to a formatted string.

#### scrubPhone

Removes formatting (hyphens, parentheses, and spaces), returning a 10-digit phone number string.

#### scrubState

Converts state names and abbreviations of any case to an all caps abbreviation string.

#### scrubZip

Removes +4 part from zip codes and returns 5-digit zip code string.

## License

MIT © [Hutson Inc](https://www.hutsoninc.com)
npm package: @hutsoninc/flatten-dir
Description: Recursively flatten a directory
Author: Austin Gordon
Latest version: 1.0.3

# flatten-dir

[![Build Status](https://travis-ci.com/hutsoninc/flatten-dir.svg?branch=master)](https://travis-ci.com/hutsoninc/flatten-dir) [![Current npm package version](https://img.shields.io/npm/v/@hutsoninc/flatten-dir.svg)](https://www.npmjs.com/package/@hutsoninc/flatten-dir)

Recursively flatten a directory (moves all files from subfolders into the one folder).

## Usage

`npm install @hutsoninc/flatten-dir`

```js
const flatten = require('@hutsoninc/flatten-dir');

await flatten('path-to-directory', {
    // options
});
```

## Options

### rename

Type: `Function`

Used to rename a file when the file name is already taken.

Default:

```js
basename => {
    if (/-\d$/.test(basename)) {
        let arr = basename.split('-');
        arr[arr.length - 1] = Number(arr[arr.length - 1]) + 1;
        return arr.join('-');
    }
    return `${basename}-1`;
}
```

## Related

- [flatten-dir-cli](https://github.com/hutsoninc/flatten-dir-cli) - CLI for this module

## License

MIT © [Hutson Inc](https://www.hutsoninc.com)
npm package: @hutsoninc/flatten-dir-cli
Description: Recursively flatten a directory
Author: Austin Gordon
Latest version: 1.0.2

# flatten-dir-cli

[![Current npm package version](https://img.shields.io/npm/v/@hutsoninc/flatten-dir-cli.svg)](https://www.npmjs.com/package/@hutsoninc/flatten-dir-cli)

Recursively flatten a directory (moves all files from subfolders into the one folder).

## Installation

`npm install --global @hutsoninc/flatten-dir-cli`

## Usage

```
$ flatten --help

  Recursively flatten a directory

  Usage
    $ flatten <directory-to-flatten>
```

```
$ tree
.
├── stuff
│   ├── things.txt
│   ├── 1
│   │   ├── things.txt
│   │   └── more-things.txt
│   └── 2
│       └── another-thing.txt
│ ...

$ flatten stuff

$ tree
.
├── stuff
│   ├── things.txt
│   ├── things-1.txt
│   ├── more-things.txt
│   └── another-thing.txt
│ ...
```

## Related

- [flatten-dir](https://github.com/hutsoninc/flatten-dir) - API for this module

## License

MIT © [Hutson Inc](https://www.hutsoninc.com)
npm package: @hutsoninc/gatsby-plugin-facebook-pixel
Description: Gatsby plugin to add a Facebook Pixel to your site.
Author: Austin Gordon
Latest version: 3.0.0

# @hutsoninc/gatsby-plugin-facebook-pixel

[![Current npm package version](https://img.shields.io/npm/v/@hutsoninc/gatsby-plugin-facebook-pixel.svg)](https://www.npmjs.com/package/@hutsoninc/gatsby-plugin-hubspot) 

A Gatsby plugin to easily add a Facebook Pixel embed code to your site.

## Installation

`npm install --save @hutsoninc/gatsby-plugin-facebook-pixel`

## Usage

```js
// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "@hutsoninc/gatsby-plugin-facebook-pixel",
      options: {
          pixelId: "YOUR_PIXEL_ID",
      },
    },
  ]
}
```

### `fbq` function

This plugin provides a [`fbq` function](https://developers.facebook.com/docs/facebook-pixel/reference#standard-events) to prevent SSR issues.

To use it, simply import it and use it like the normal [`fbq` function](https://developers.facebook.com/docs/facebook-pixel/reference#standard-events).

```
import { fbq } from '@hutsoninc/gatsby-plugin-facebook-pixel'

fbq('track', 'Contact')
```

## License

MIT © [Hutson Inc](https://www.hutsoninc.com)
npm package: @hutsoninc/mapbox-utils
Description: Mapbox utilities
Author: Austin Gordon
Latest version: 1.0.1

# Hutson Mapbox Utilities

[![Current npm package version](https://img.shields.io/npm/v/@hutsoninc/mapbox-utils.svg)](https://www.npmjs.com/package/@hutsoninc/mapbox-utils) 

## Installation

`npm install @hutsoninc/mapbox-utils`

## Usage

```js
import MapboxUtils from '@hutsoninc/mapbox-utils'

const mapboxUtils = new MapboxUtils({
    access_token: 'YOUR_MAPBOX_ACCESS_TOKEN'
})
```

## License

MIT © [Hutson Inc](https://www.hutsoninc.com)
npm package: @hutsoninc/utils
Description: Hutson marketing team utility belt
Author: AustinLeeGordon
Latest version: 1.0.6

# utils

[![Build Status](https://travis-ci.com/hutsoninc/utils.svg?branch=master)](https://travis-ci.com/hutsoninc/utils) [![Current npm package version](https://img.shields.io/npm/v/@hutsoninc/utils.svg)](https://www.npmjs.com/package/@hutsoninc/utils) 

Hutson marketing team utility belt. Used for prototyping and creating one-off tools and scripts.

## Usage

`npm install @hutsoninc/utils`

```js
const {
    csvToJson,
} = require('@hutsoninc/utils')

const csv = 'id\n1\n2'

await csvToJson(csv)
// => [{id: 1}, {id: 2}]
```

### API

#### csvToJson

Converts a CSV string to a JavaScript object.

```js
const csv = 'id\n1\n2'

await csvToJson(csv)
// => [{id: 1}, {id: 2}]
```

#### delay

Asynchronous function to wait for a specified amount of time in ms.

```js
await delay(3000)
// Resolves after 3000ms (3 seconds)
```

#### jsonToCsv

Converts a JavaScript object to a CSV string.

```js
const obj = [{ id: 1 }, { id: 2 }]

jsonToCsv(obj, ['id'])
// => 'id\n1\n2'
```

#### xmlToJson

Converts a XML string to a JavaScript object.

```js
const xml = '<root>Hello World</root>'

await xmlToJson(xml)
// => { root: 'Hello World' }
```

## License

MIT © [Hutson Inc](https://www.hutsoninc.com)