# anchor

> High-level validation library for Node.js (used in Waterline)

Latest version **1.4.2** (published 2025-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install anchor
pnpm add anchor
yarn add anchor
bun add anchor
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2025-11-21 |
| First published | 2012-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 40.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 149 |
| Author | Mike McNeil |
| Maintainers | particlebanana, sgress454, balderdashy, mikermcneil, eashaw |
| Keywords | validation, recursive-validator, nested, validator, strict-types, web-framework, type-coercion, waterline, validate-parameters, sails.js, sails |

## Links

- npm: https://www.npmjs.com/package/anchor
- Repository: https://github.com/sailsjs/anchor
- Homepage: https://sailsjs.com
- Issues: https://github.com/sailsjs/anchor/issues
- npm.io page: https://npm.io/package/anchor

## Dependencies (2)

- [validator](https://npm.io/package/validator.md) 13.15.23
- [@sailshq/lodash](https://npm.io/package/@sailshq/lodash.md) ^3.10.2

## Alternatives

- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads
- [@oridune/validator](https://npm.io/package/@oridune/validator.md) — 16 weekly downloads

## Recent versions

- 1.4.2 (latest) — 2025-11-21
- 1.4.1 — 2022-08-22
- 1.4.0 — 2018-12-17
- 1.3.0 — 2018-04-01
- 1.2.1 — 2018-04-01
- 1.2.0 — 2017-10-20
- 1.1.2 — 2017-09-24
- 0.11.6 — 2017-08-08
- 1.1.1 — 2016-12-22
- 1.1.0 — 2016-12-22
- 1.0.0 — 2016-12-21
- 0.11.5 — 2016-12-05
- 0.11.4 — 2016-12-05
- 0.11.3 — 2016-10-25
- 0.11.2 — 2016-03-17
- … 32 more at https://npm.io/package/anchor/versions

## README

# anchor

Anchor is a JavaScript library that lets you enforce [high-level validation rules](https://sailsjs.com/documentation/concepts/models-and-orm/validations).  It is used in [Waterline and Sails](https://sailsjs.com/features) to complement the type safety imposed by [rttc](https://npmjs.com/package/rttc).

(Built on top of the great work with https://www.npmjs.com/package/validator)

## Usage


#### Documentation

The up-to-date documentation for high-level anchor validation rules is maintained on the [Sails framework website](http://sailsjs.com).

You can find a detailed reference of all validation rules under [Concepts > Models & ORM > Validations](http://sailsjs.com/documentation/concepts/models-and-orm/validations).

> For more details on standalone usage, see the source code in this repo.

<!--
  #### Standalone usage

  For the browser:

  ```html
  <script type='text/javscript' src="/js/anchor.js"></script>
  ```

  For Node.js:

  ```bash
  npm install anchor
  ```

  ```javascript
  var anchor = require('anchor');
  ```
-->

## Help

Check out the recommended [community support options](http://sailsjs.com/support) for tutorials and other resources.  If you have a specific question, or just need to clarify how something works, [ask for help](https://gitter.im/balderdashy/sails) or reach out to the core team [directly](http://sailsjs.com/flagship).

You can keep up to date with security patches, the Sails/Waterline release schedule, new database adapters, and events in your area by following us [@sailsjs](https://twitter.com/sailsjs) and [@waterlineorm](https://twitter.com/waterlineorm) on Twitter.

## Bugs &nbsp; [![NPM version](https://badge.fury.io/js/anchor.svg)](http://npmjs.com/package/anchor)
To report a bug, [click here](http://sailsjs.com/bugs).

## Contribute &nbsp; [![Build Status](https://travis-ci.org/sailshq/anchor.png?branch=master)](https://travis-ci.org/sailshq/anchor)
Please observe the guidelines and conventions laid out in our [contribution guide](http://sailsjs.com/documentation/contributing) when opening issues or submitting pull requests.

#### Tests
All tests are written with [mocha](https://mochajs.org/) and should be run with [npm](https://www.npmjs.com/):

``` bash
  $ npm test
```


## License

Copyright 2012-present, [Mike McNeil](https://twitter.com/mikermcneil)

This core package, like the rest of the [Sails framework](http://sailsjs.com), is free and open-source under the [MIT License](http://sailsjs.com/license).

[![image_squidhome@2x.png](http://sailsjs.com/images/bkgd_squiddy.png)](http://sailsjs.com/about)

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