open-index/open-npm huggingface dataset:
npm package: @momsfriendlydevco/path-match
Description: Simple Express-like URL path matching
Author: Matt Carter
Latest version: 1.1.0

@MomsFriendlyDevCo/path-match
=============================
Express-like path matching module.


* Supports various types - Path expressions, Regular Expression matching and functions
* ... and array combinations of any of the above
* ES6 compatible
* Simple class/instance interface
* Human readable `.toString()` method for debugging against each route
* Optional route parameters - e.g. `/api/widgets/:id?`


```javascript
import RoutePath, {compare, compile} from '@MomsFriendlyDevCo/path-match';

let rp1 = new RoutePath('/'); // or compile('/')
rp1.isMatch('/') //= {}
rp1.isMatch('/foo') //= false

let rp2 = new RoutePath('/api/widgets/:id');
rp2.isMatch('/api/widgets') //= false
rp2.isMatch('/api/widgets/123') //= {id: '123'}

let rp3 = new RoutePath('/api/doodads/:id?');
rp3.isMatch('/api/doodads') //= {id: null}
rp3.isMatch('/api/doodads/') //= {id: null}
rp3.isMatch('/api/doodads/123') //= {id: '123'}

// Or via shorthand methods:
compare('/api/widgets/:id', '/api/widgets'); //= false
compare('/api/widgets/:id', '/api/widgets/123'); //= {id: '123'}

// Arrays of items
let rp4 = new RoutePath(['/foo', '/bar', '/baz']);
rp4.isMatch('/bar') //= {}
rp4.isMatch('/quz') //= false

// Function matchers
let rp5 = new RoutePath([
    '/foo',
    (path) => path.startsWith('/bar'),
    /^\/baz\/?$/i,
]);
rp5.isMatch('/FOO') //= {}
rp5.isMatch('/bar') //= {}
rp5.isMatch('/BAZ') //= {}
```


Why?
----
Because surprisingly, nearly all of the modules out there are either old (in some cases 7 years+), don't have adequate testkits, arn't ES6 compatible or just have an awful syntax.

* [path-to-regexp](https://github.com/pillarjs/path-to-regexp) - The seminal NPM package, pretty old, no decent testkits to show proof-of-work and its syntax for extracting path segments is truly awful
* [path-match](https://github.com/pillarjs/path-match) - Seems to work but will _always match_ even if the route doesn't resemble the input at all
* ...about 100 different clones of path-to-regexp
npm package: @momsfriendlydevco/pdf
Description: Generate dynamic PDFs using Vue templates and Prince
Author: Matt Carter
Latest version: 1.0.4

@MomsFriendlyDevCo/PDF
======================
Generate dynamic PDFs using Vue templates and Prince.

* Uses [@MomsFriendlyDevCo/Vue-Template](https://github.com/MomsFriendlyDevCo/vue-template) for templating allowing full Vue templating
* Uses [Prince](https://github.com/rse/node-prince) to render PDFs avoiding Puppeteer madness


```javascript
// Standalone generator
(new PDF())
	.templatePath('./test/data/simple.html')
	.data({
		title: 'Hello World',
		signoff: 'Yours happily',
		customer: {
			name: 'Joe Random',
			email: 'joe@mailinator.com',
			pets: [
				{name: 'Cookie', type: 'Cat'},
				{name: 'Fido', type: 'Dog'},
			],
		},
	})
	.asFile()
	.then(path => /* Do something with the output PDF path on disk */)
```

```javascript
// Example within Express
app.get('/api/generate-pdf', (req, res) => {
	(new PDF())
		.templatePath('./test/data/simple.html')
		.data({title: 'Hello World'}) // Shorted version of the above
		.asStream()
		.then(stream => stream.pipe(res)) // Pipe PDF into Express response
})
```


API
===

PDF (constructor)
-----------------
Initiate the PDF instance and populate default options.


templatePath(path)
------------------
Set the local file path of the HTML template to use.
Returns the chainable class instance.


template(html)
--------------
Set the raw HTML contents of the template.
Returns the chainable class instance.


data(dataObject)
----------------
Specify the data to use when rendering the template.
Returns the chainable class instance.


as(type)
--------
Specify the type of output after generating.
This can be used explicitly with `generate()` or wrapped as a promise using one of the `asBuffer()`, `asFile()`, `asStream()` convenience functions.
Returns the chainable class instance.

```javascript
(new PDF())
	.templatePath(`${__dirname}/data/simple.html`)
	.data({title: 'Hello World'})
	.asFile('stream')
	.then(stream => /* Do something with the output stream */)
```


fix(fix, status)
----------------
Toggle the application of various fixes.
Accepts the fix name and the enabled status or an object of {key: Boolean}


generate(data) / asBuffer(data) / asFile(data) / asStream(data)
---------------------------------------------------------------
Convenience functions to set the output type + run `generate()` + return a promise.
Accepts an optional data object which is passed to `data()` if specified.
Returns a promise which resolves with the desired type.
npm package: @momsfriendlydevco/php-serialize
Description: Fork of https://github.com/steelbrain/php-serialize/tree/main with better errors
Author: mfdc
Latest version: 5.2.1

# PHP-Serialize

## < Fork >

This fork adds better error messages for string decoding.

Also, to get this to be usable as a git URL dependency:
- ~~`yarn build:*` was replaced with `npm run build:*` in the package.json,
which avoided needing `yarn` installed into devDependencies~~
- `yarn` was added into devDependencies
- `npm i --ignore-scripts` was added into the lifecycle prepare
- `tsc` errors are ignored inside the prepare lifecycle script, because this is
usually ran without all the required @types packages already installed on the
host machine

`npm` is very annoying with lifecycle scripts. I never want to touch this
feature of `npm` again, but this project depends on them

To run tests,`npm run build:cjs` then `npm test`.

## </ Fork >

It also supports `Serializable` objects decode. Here's how you can use them.

#### Installation

```sh
$ npm install php-serialize # If you're using npm
$ yarn add php-serialize # If you're using Yarn
```

#### Usage

```js
import {serialize, unserialize} from 'php-serialize'

class User {
  constructor({ name, age }) {
    this.name = name
    this.age = age
  }
  serialize() {
    return JSON.stringify({ name: this.name, age: this.age })
  }
  unserialize(rawData) {
    const { name, age } = JSON.parse(rawData)
    this.name = name
    this.age = age
  }
}
const steel = new User({ name: 'Steel Brain', age: 17 })
const serialized = serialize(steel)
const unserialized = unserialize(serialized, { User: User }) // Passing available classes
console.log(unserialized instanceof User) // true

const serializedForNamespace = serialize(steel, {
  'MyApp\\User': User,
})
// ^ Above code will serialize User class to given name
```

#### API

```js
export function serialize(
  item: any,
  phpToJsScope: Object = {},
  options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
): string
export function unserialize(
  item: string,
  scope: Object = {},
  options: { strict: boolean, encoding: 'utf8' | 'binary' } = { strict: false, encoding: 'utf8' }
): any
export function isSerialized(
  item: any,
  strict: false
): boolean
```

#### License

This project is licensed under the terms of MIT License. See the License file for more info.
npm package: @momsfriendlydevco/repl
Description: MFDC REPL CLI
Author: Matt Carter
Latest version: 2.1.2

MFDC-REPL
=========
[MFDC's](http://mfdc.biz) own internal REPL command line interface.

This project provides the executable `mrepl` which has the following functionality over regular REPL:

* **Babel pre-compiler** (`babel` plugin) - All code is automatically compiled via [BabelJS](http://babeljs.io) before it is run - making things like arrow functions available on older Node releases
* **Lodash** (`lodash` plugin) - lodash is provided as `lodash`, `l` and `__`
* **Moment** (`moment` plugin) - moment is provided as `moment`
* **Mongoose project support** (`mongoose` plugin) - If the files `./config/index.js`, `./config/db.js` and `./models/index.js` are found they are loaded in that order (with `./models/index.js` expected to return an object containing the available compiled schemas. Models are then provided in the `db` object. e.g. `db.users.find()` will return all users.
* **STDIN slurping** (`stdin` plugin) - Any piped input into the program is provied as the `input` variable. Automatic decoding of the variable will be attempted by `JSON.parse()` otherwise it will be a raw string.
* **History saving** - History saing is enabled by default




Installation
------------
Simply run the following:

	sudo npm install -g @momsfriendlydevco/repl

You should now be able to run the REPL interface with:

	mrepl


Plugins
=======
Plugins are provided in the `plugins/` folder within the main script file.

Each plugin is a simple JavaScript file which is expected to expose a function taking a callback and the main `app` argument. Each plugin can decorate the properties of the program and return the callback when finished.


Some usefully exposed properties:

| Property path        | Type    | Default         | Description                                                           |
|----------------------|---------|-----------------|-----------------------------------------------------------------------|
| `app`                | Object  | Complex         | The main application object - an instance of a `commander` definition |
| `app.verbose`        | Number  | 0               | Verbosity level                                                       |
| `app.plugin`         | Array   | `['./plugins']` | Globs to search for plugins                                           |
| `app.repl`           | Object  | Complex         | Repl options when creating the interface                              |
| `app.repl.globals`   | Object  | `{}`            | Any exported globals that should be available inside the REPL session |
| `app.repl.eval`      | Array   | `[]`            | Array of evaluation functions to run. Each Eval is run as a compose pipeline with the final output being returned to the REPL session |
| `inspect.depth`      | Number  | 2               | How deeply to examine objects when printing results to the console    |
| `inspect.colors`     | Boolean | `true`          | Whether colors are enabled when printing results to the console       |
npm package: @momsfriendlydevco/sanity
Description: Generic server sanity checking
Author: Matt Carter
Latest version: 1.3.1

@MomsFriendlyDevCo/Sanity
=========================
Sanity checking framework.

```javascript
import email from '@momsfriendlydevco/email';

export default {
	id: 'email',
	frequency: '1h',
	handler() {
		return email()
			.to('null@mfdc.dev')
			.from('someone@somewhere.com')
			.subject('Email sanity check')
			.text(`This is a test of the email dispatch system\n\nPlease disreguard this email`)
			.send()
			.then(()=> 'PASS: Email sent successfully')
			.catch(e => `WARN: ${e.toString()}`)
	},
};
```



Trapping top-level errors
-------------------------
To trap top-level errors set `isolate: true` within a Sanity module.

```javascript
export default {
	id: 'topLevelThrow',
	frequency: '1s',
	isolate: true,
	handler() {
		setTimeout(()=> {
			throw new Error('Top level error');
		});

		return new Promise(resolve => {
			setTimeout(()=> resolve('Pass: Throw exit inner thread'), 1000);
		});
	},
}
```