Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone.validator

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone.validator - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

14

package.json
{
"name": "backbone.validator",
"description": "Validation plugin for Backbone allowing for setting of default values",
"version": "1.1.6",
"version": "1.1.7",
"repository": {

@@ -10,13 +10,9 @@ "url": "git://github.com/toddself/Backbone.Validator.git"

"scripts": {
"postinstall": "node post-install",
"pre-commit": "npm run lint && npm test",
"prepublish": "docme README.md",
"lint": "jshint",
"test": "tape test/*js"
},
"dependencies": {
"backbone": "~1.1.2"
},
"devDependencies": {
"backbone": "~1.1.0",
"jshint": "~2.3.0",
"tape": "~2.3.0",
"docme": "~0.1.4"
"tape": "~2.3.0"
},

@@ -23,0 +19,0 @@ "author": {

@@ -143,515 +143,4 @@ # Backbone.Validator

<div>
<div class="jsdoc-githubify">
<section>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<dl>
<dt>
<h4 class="name" id="inList"><span class="type-signature"></span>inList<span class="signature">(value, list, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Tests if a value is a member of a given array</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"><p>value to test</p></td>
</tr>
<tr>
<td class="name"><code>list</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>the list of acceptable values</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L228">lineno 228</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="isKey"><span class="type-signature"></span>isKey<span class="signature">(value, obj, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Tests to see if the value is the key on an object</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the value to test</p></td>
</tr>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the object to test for keys</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L242">lineno 242</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="maxLength"><span class="type-signature"></span>maxLength<span class="signature">(value, length, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Tests to see if the value is under a max length</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"><p>the value to test: string or array</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the maximum length for value</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L256">lineno 256</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="maxValue"><span class="type-signature"></span>maxValue<span class="signature">(value, limit, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Test a number fo make sure it's lower than a specified value</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the number to test</p></td>
</tr>
<tr>
<td class="name"><code>limit</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the maximum value for this number</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L316">lineno 316</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="minLength"><span class="type-signature"></span>minLength<span class="signature">(value, length, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Test to see if the value is over a min length</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"><p>the value to test: string or array</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the minumum value for length</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L272">lineno 272</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="minValue"><span class="type-signature"></span>minValue<span class="signature">(value, limit, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Tests a number to make sure it's at least a specified value or higher</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the number to test</p></td>
</tr>
<tr>
<td class="name"><code>limit</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the minimum value</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L302">lineno 302</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toEqual"><span class="type-signature"></span>toEqual<span class="signature">(value, example, attribute)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Test to see if two values are shallow equal</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"><p>the value to test</p></td>
</tr>
<tr>
<td class="name"><code>example</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"><p>the desired value</p></td>
</tr>
<tr>
<td class="name"><code>attribute</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the name of the model attribute</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L288">lineno 288</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>error message, if any</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="Validate"><span class="type-signature"></span>Validate<span class="signature">(attributes, options)</span><span class="type-signature"> &rarr; {array}</span></h4>
</dt>
<dd>
<div class="description">
<p>A drop-in replacement for the <code>validate</code> method on a Backbone model.</p>
<p>Usage:</p>
<pre><code class="lang-javascript">var MyModel = Backbone.Model.extend({});
MyModel.prototype.validate = require('backbone.validate');</code></pre>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>attributes</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the attributes being set</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the options hash</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js">/Users/todd/src/Backbone.Validator/backbone.validator.js</a>
<span>, </span>
<a href="https://github.com/toddself/Backbone.Validator/blob/master//Users/todd/src/Backbone.Validator/backbone.validator.js#L118">lineno 118</a>
</li>
</ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>array of error objects, if any.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
*generated with [docme](https://github.com/thlorenz/docme)*

@@ -658,0 +147,0 @@ </div>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc