# sails-congruence

> Generate browser-compatible validator functions for Sails.js models. A congruence extension.

Latest version **0.0.2** (published 2014-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install sails-congruence
pnpm add sails-congruence
yarn add sails-congruence
bun add sails-congruence
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2014-09-03 |
| First published | 2014-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Travis Webb |
| Maintainers | tjwebb |
| Keywords | sails.js, sails, model, validator, function, generator, congruence |

## Links

- npm: https://www.npmjs.com/package/sails-congruence
- Repository: https://github.com/tjwebb/sails-congruence
- Issues: https://github.com/tjwebb/sails-congruence/issues
- npm.io page: https://npm.io/package/sails-congruence

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2014-09-03
- 0.0.0 — 2014-09-03

## README

# <img src="http://cdn.tjw.io/images/sails-logo.png" height='43px' />-congruence

Generate browser-compatible validator functions for Sails.js models. A [congruence](https://www.npmjs.org/package/congruence) extension.

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Dependency Status][daviddm-image]][daviddm-url]

## Install
```sh
$ npm install sails-congruence --save
```

## Usage
Create a validator function from a model, e.g. [Account](https://github.com/tjwebb/xtuple-api/blob/master/api/models/Account.js):

```js
var congruence = require('sails-congruence');
var validateAccount = congruence.getSailsValidator(Account);

var valid = validateAccount({
  name: 'myaccount',
  type: 'X'
})
// returns false. 'X' is not a valid account type
// https://github.com/tjwebb/xtuple-api/blob/master/api/models/Account.js#L17
```

## API

#### `.getSailsValidator(model)`
Generate a Sails.js validator function for the specified model

| @param | description |
|:---|:---|
| `model` | the model to create the validator function for |
| **@return** | description |
| `Function` | a function that will return true if model is valid, false otherwise

## License
MIT

[sails-logo]: http://cdn.tjw.io/images/sails-logo.png
[sails-url]: https://sailsjs.org
[npm-image]: https://img.shields.io/npm/v/sails-congruence.svg?style=flat
[npm-url]: https://npmjs.org/package/sails-congruence
[travis-image]: https://img.shields.io/travis/tjwebb/sails-congruence.svg?style=flat
[travis-url]: https://travis-ci.org/tjwebb/sails-congruence
[daviddm-image]: http://img.shields.io/david/tjwebb/sails-congruence.svg?style=flat
[daviddm-url]: https://david-dm.org/tjwebb/sails-congruence

---
_Source: https://npm.io/package/sails-congruence · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
