open-index/open-npm huggingface dataset:
npm package: @sa0001/api-validator
Description: API-Validator is a library designed for validating input/output of API methods, with a very powerful but compact syntax.
Author: sa0001
Latest version: 0.0.14

# API-Validator

API-Validator is a library designed for validating input/output of API methods, with a very powerful but compact syntax.

## Simple Usage

A line of code is worth a thousand words.  Here's a carefully curated minimal example of a validator schema, and both passing and failing input.

	var ApiValidator = require('@sa0001/api-validator')
	var validator = ApiValidator.new() // use default options
	
	var schema = validator.schema({obj:1,schema:{
		a: {int:1},
	}})
	
	var goodInput = {
		a: 1,
	}
	var badInput = {
		a: true,
	}
	
	// passing
	result = schema.test(goodInput)
	
	// failing
	try {
		result = schema.test(badInput)
	catch (err) {
		err
	}
	
	var output = ApiValidator.new().schema(schema).input(input).test()

## Guiding Principles

- the primary purpose of this library is for validating API input/output in JSON format, so don't count on values other than the following to be preserved:
 -- boolean
 -- number
 -- string
 -- array
 -- plain object
- all other types of value, including errors, symbols, may not be preserved
- only `null` can be JSON-stringified, so all the following values are considered the same as null:
 -- `undefined`, `null`,`""`, `NaN`, `Infinity`, `-Infinity`

## Concepts

Simple Types: these are...
- `arr`, `array`, `isArray`
- `bool`, `boolean`, `isBoolean`
- `num`, `number`, `isNumber`
- `obj`, `object`, `isObject`
- `str`, `string`, `isString`
- `any`, `mix`, `mixed`
-- allows any type of value, however most operators cannot be used

Complex Types: these are...
- `int`, `integer`, `isInteger`

Operators: these are...
- `trim`, `toTrim`, `strip`, `toStrip` (for Ruby lovers)
- `isRound`
- `isLower`, `isLowerCase`
- `isUpper`, `isUpperCase`
- `isTrim`, `isTrimmed`, `isStripped` (for Ruby lovers)

Descriptors: these are...

## Example

```
	# example: sorted & unique array of enum values
	{arr:1,sort:1,uniq:1,vals:{str:1,in:SomeEnum}}
	
	# example: array of lat/lon
	{arr:1,schema:[
	    {num:1,isRound:8,btw:[-90,90]}
	    {num:1,isRound:8,btw:[-180,180]}
	]}
	
	# example: object of lat/lon
	{obj:1,schema:{
	    lat: {num:1,isRound:8,btw:[-90,90]}
	    lon: {num:1,isRound:8,btw:[-180,180]}
	}}
	
	# example: object of sorters (col -> dir)
	{obj:1,keys:{str:1,regex:/^[\w]+$/},vals:{str:1,in:['ASC','DESC']}}
```

## TODO

- operator: compact
- operator: filter
- operator: reject
npm package: @sa0001/cakefile
Description: https://gist.github.com/vjpr/319c0c8f82ef285489f5
Author: sa0001
Latest version: 0.0.2

https://gist.github.com/vjpr/319c0c8f82ef285489f5

# @sa0001/TODO

> ${DESCRIPTION}

[![NPM Version][npm-image]][npm-url]

## Install

```bash
npm install --save @sa0001/TODO
```

## Usage

```javascript
const TODO = require('@sa0001/TODO')
```

## License

[MIT](http://vjpr.mit-license.org)

[npm-url]: https://npmjs.org/package/@sa0001/TODO
npm package: @sa0001/coffee-cache
Description: Caches the contents of required CoffeeScript files so that they are not recompiled to help improve startup time
Author: Doug Patti
Latest version: 1.0.2

# coffee-cache

Caches the contents of required CoffeeScript files so that they are not
recompiled to help improve startup time.

## What it does

In a Node.js application written in CoffeeScript, every time you start the
application, all the relevant files must be compiled when they are required. If
you have a very large application, this process can consume a large portion of
your startup time. By caching the compiled JavaScript files, only those that
have been updated must be recompiled, and the rest can be loaded off of the
disk. In our usage, this has reduced the startup time from 7s to 2s, which means
a lot when you have to restart your application every time you want to test a
change.

## How to use

1. Add to your package.json dependencies and run `npm install` or run `npm install coffee-cache`.

2.  In your entry point file, add the following:

    ```coffee
    require('coffee-cache')
    ```

3. That's it. By default the files are cached in the `./.coffee/` directory. If
   you want to change this, see below.

## Extra configuration

You can specify the location of the directory to use for the cached files in one
of two ways:

1. Start the process with the `COFFEE_CACHE_DIR` variable set:

    ```sh
    $ COFFEE_CACHE_DIR=/tmp/coffee-cache coffee app.coffee
    ```

2. Use the `setCacheDir` method on the required module:

    ```coffee
    require('coffee-cache').setCacheDir('../cached/')
    ```

Just make sure your process has permission to create the necessary folder or
files.
npm package: @sa0001/deep-diff
Description: [NPM][https://www.npmjs.com/package/@sa0001/deep-diff]
Author: sa0001
Latest version: 0.0.11

# @sa0001/deep-diff

[NPM][https://www.npmjs.com/package/@sa0001/deep-diff]

This module makes a reliable, readable, deep diff between any two objects or arrays.

There are options to keep only the fields which are different on the right side, or to display both the left and right values for any field which is different.

## Install

```bash
npm install @sa0001/deep-diff
```

## Usage

```javascript
const deepDiff = require('@sa0001/deep-diff')

let left = {
	fieldA: 'a'
	fieldB: 'b'
	fieldC: {
		fieldD: 'd'
	}
}
let right = {
	fieldA: 'a'
	fieldB: 'B'
	fieldC: {
		fieldD: 'D'
	}
	fieldE: 'e'
}

// by default, the result is a comparison of all values
//  which are different in `left` and `right`
deepDiff(left, right)
/*
	{
		fieldB: {
			l: 'b',
			r: 'B'
		},
		fieldC: {
			fieldD: {
				l: 'd',
				r: 'D'
			}
		},
		fieldE: {
			l: undefined,
			r: 'e'
		}
	}
*/

// with option `keepRight`, the result will contain
//  all values in `right` which are different from `left`
deepDiff(left, right, { keepRight: true })
/*
	{
		fieldB: 'B',
		fieldC: {
			fieldD: 'D'
		}
	}
*/

// with option `shallow`, the diff will be at top-level
//  (but the comparison is still deep)
deepDiff(left, right, { shallow: true })
/*
	{
		fieldB: {
			l: 'b',
			r: 'B'
		},
		fieldC: {
			l: {
				fieldD: 'd'
			},
			r: {
				fieldD: 'D'
			}
		}
		fieldE: {
			l: undefined,
			r: 'e'
		}
	}
*/
```

## License

[MIT](http://vjpr.mit-license.org)
npm package: @sa0001/luxon-dtz
Description: [NPM][https://www.npmjs.com/package/@sa0001/luxon-dtz]
Author: sa0001
Latest version: 0.0.6

# @sa0001/luxon-dtz

[NPM][https://www.npmjs.com/package/@sa0001/luxon-dtz]

A very thin wrapper of `luxon.DateTime`, which makes some key changes:

* All static constructors (i.e. `fromISO`, `fromMillis`, etc) are wrapped to throw an error if the resulting date is invalid.  The default behavior is to allow creating an invalid date, which returns `null` from all output methods such as `toISO`.
* Instance method `setZone` was wrapped to throw an error if the timezone is not valid.  The default behavior is for the current date to become invalid, which returns `null` from all output methods such as `toISO`.
* All static constructors (i.e. `fromISO`, `fromMillis`, etc) are wrapped to set the timezone to UTC using `toUTC()`.  As a result, all output (ex. `toFormat`, `toISO`) will be in UTC unless the timezone is explicitly set using `setZone('...')`.
* Static constructor `fromISO` was changed to only allow a *full* ISO datetime string *with* timezone offset or `Z` (ex. "2001-02-03T04:05:06.789Z").  The default behavior is to accept almost any substring, even missing the date component, time component, or offset/timezone information.  When constructing an instance from such a substring, `fromFormat` should be used instead.

## Install

```bash
npm install @sa0001/luxon-dtz
```

## Usage

```javascript
const Dtz = require('@sa0001/luxon-dtz')
let dt

// throw an error if the resulting date is invalid:

dt = Dtz.fromISO('2001-01-01T99:99:99.999Z')
// Error("Invalid DateTime: you specified 99 (of type number) as a hour, which is invalid")

// throw an error if the timezone is invalid:

dt = Dtz.now().setZone('unknown').toISO()
// Error('Invalid DateTime: the zone "unknown" is not supported')

// automatically set timezone to UTC:

dt = Dtz.fromISO('2001-02-03T05:05:06.789+01:00').toISO()
// '2001-02-03T04:05:06.789Z'

dt = Dtz.fromISO('2001-02-03T05:05:06.789+01:00').setZone('UTC+1').toISO()
// '2001-02-03T05:05:06.789+01:00'

// only allow a full ISO datetime string for `fromISO`:

dt = Dtz.fromISO('2001-02-03')
// Error("Invalid ISO format: 2001-02-03")

dt = Dtz.fromISO('04:05:06')
// Error("Invalid ISO format: 04:05:06")
```

## License

[MIT](http://vjpr.mit-license.org)
npm package: @sa0001/tap-teamcity
Description: [NPM][https://www.npmjs.com/package/@sa0001/tap-teamcity]
Author: sa0001
Latest version: 0.0.11

# @sa0001/tap-teamcity

[NPM][https://www.npmjs.com/package/@sa0001/tap-teamcity]

This module converts the TAP-format output of running `tap`, to the Junit-format expected by Teamcity.

## Install

```bash
npm install @sa0001/tap-teamcity
```

## Usage

It can be run from the command line, in which case it reads from stdin and writes to stdout:

```bash
./node_modules/.bin/tap ./test.js > ./test-results.tap
cat ./test-results.tap | node ./node_modules/tap-teamcity/dist/index.js > ./test-results.xml
```

Or it can be used as a module, in which case there are a few more options available:

```javascript
const tapTeamcity = require('@sa0001/tap-teamcity')

await tapTeamcity('./test-results.tap', './test-results.xml', {
	// custom top-level suite name
	suiteName: 'TAP',
	// edit the full name of the test, for example to shorten or remove the file path
	editTestName: (name) => { return name },
	// filter the lines of the error stack, to remove noise
	filterErrorStack: (line) => { return true },
})
```

## License

[MIT](http://vjpr.mit-license.org)
npm package: @sa0001/type-of
Description: [NPM][https://www.npmjs.com/package/@sa0001/type-of]
Author: sa0001
Latest version: 0.0.7

# @sa0001/type-of

[NPM][https://www.npmjs.com/package/@sa0001/type-of]

A library which returns an accurate type for any possible value.

The following standard types are known to work correctly:
* arguments
* array
* boolean
* date
* error
* float32array
* float64array
* function
* int16array
* int32array
* int8array
* map
* null
* number
* object
* promise
* regexp
* set
* string
* symbol
* uint16array
* uint32array
* uint8array
* uint8clampedarray
* undefined
* weakmap

However because `Object.prototype.toString.call(val)` is used, a type does not have to be in this list for it to return the correct value.

## Install

```bash
npm install @sa0001/type-of
```

## Usage

```javascript
const typeOf = require('@sa0001/type-of')

typeOf(arguments) // "arguments"
typeOf(['a',1]) // "array"
typeOf(true) // "boolean"
typeOf(new Date()) // "date"
typeOf(new Error()) // "error"
typeOf(function(){}) // "function"
typeOf(null) // "null"
typeOf(1.23) // "number"
typeOf({a:1}) // "object"
typeOf(new Promise()) // "promise"
typeOf(/\w/) // "regexp"
typeOf(new Set()) // "set"
typeOf('abc') // "string"
typeOf(Symbol('a')) // "symbol"
typeOf(undefined) // "undefined"
```

## License

[MIT](http://vjpr.mit-license.org)