Skip to content
This repository has been archived by the owner on Apr 5, 2020. It is now read-only.

Commit

Permalink
lint config rule
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianoPAlmeida committed Jun 4, 2017
1 parent 956d424 commit 2132776
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 48 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Expand Up @@ -35,6 +35,7 @@
}
],
"array-callback-return" : "error",
"consistent-return" : "error"
"consistent-return" : "error",
"block-scoped-var" : "error"
}
}
2 changes: 1 addition & 1 deletion __test__/index-tests.js
Expand Up @@ -4,7 +4,7 @@ const test = require('blue-tape');
const OGMNeoIndex = require('../lib/ogmneo-index');

test('Test create Index', (assert) => {
OGMNeoIndex.create('object', ['name']).then((result) => {
OGMNeoIndex.create('object', ['name','test']).then((result) => {
assert.notEqual(result, null);
assert.end();
});
Expand Down
2 changes: 1 addition & 1 deletion docs/OGMNeo.html
Expand Up @@ -709,7 +709,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/OGMNeoCypher.html
Expand Up @@ -361,7 +361,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
22 changes: 14 additions & 8 deletions docs/OGMNeoIndex.html
Expand Up @@ -136,7 +136,7 @@ <h3 class="subsection-title">Methods</h3>



<h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">(label, fields)</span><span class="type-signature"> &rarr; {Promise.&lt;(object|Error)>}</span></h4>
<h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">(label, properties)</span><span class="type-signature"> &rarr; {Promise.&lt;(object|Error)>}</span></h4>



Expand Down Expand Up @@ -202,13 +202,16 @@ <h5>Parameters:</h5>

<tr>

<td class="name"><code>fields</code></td>
<td class="name"><code>properties</code></td>


<td class="type">


<span class="param-type">array</span>
|

<span class="param-type">string</span>



Expand All @@ -218,7 +221,7 @@ <h5>Parameters:</h5>



<td class="description last">The fields where to create the index. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0</td>
<td class="description last">The array fields where to create the index or in case of only a string name of the property. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0</td>
</tr>


Expand Down Expand Up @@ -312,7 +315,7 @@ <h5>Returns:</h5>



<h4 class="name" id=".drop"><span class="type-signature">(static) </span>drop<span class="signature">(label, fields)</span><span class="type-signature"> &rarr; {Promise.&lt;(object|Error)>}</span></h4>
<h4 class="name" id=".drop"><span class="type-signature">(static) </span>drop<span class="signature">(label, properties)</span><span class="type-signature"> &rarr; {Promise.&lt;(object|Error)>}</span></h4>



Expand Down Expand Up @@ -371,20 +374,23 @@ <h5>Parameters:</h5>



<td class="description last">Label where to create the index.</td>
<td class="description last">Label where to drop the index.</td>
</tr>



<tr>

<td class="name"><code>fields</code></td>
<td class="name"><code>properties</code></td>


<td class="type">


<span class="param-type">array</span>
|

<span class="param-type">string</span>



Expand All @@ -394,7 +400,7 @@ <h5>Parameters:</h5>



<td class="description last">The fields where to create the index. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0</td>
<td class="description last">The array fields where to drop the index or in case of only a string name of the property. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0</td>
</tr>


Expand Down Expand Up @@ -505,7 +511,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/OGMNeoNode.html
Expand Up @@ -2313,7 +2313,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
6 changes: 3 additions & 3 deletions docs/OGMNeoQuery.html
Expand Up @@ -425,7 +425,7 @@ <h3 class="subsection-title">Methods</h3>



<h4 class="name" id=".query"><span class="type-signature">(static) </span>query<span class="signature">(label<span class="signature-attributes">opt</span>, where<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="OGMNeoQuery.html">OGMNeoQuery</a>}</span></h4>
<h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">(label<span class="signature-attributes">opt</span>, where<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="OGMNeoQuery.html">OGMNeoQuery</a>}</span></h4>



Expand Down Expand Up @@ -1363,7 +1363,7 @@ <h3 class="subsection-title">Methods</h3>



<h4 class="name" id=".query"><span class="type-signature">(static) </span>query<span class="signature">(label<span class="signature-attributes">opt</span>, where<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="OGMNeoQuery.html">OGMNeoQuery</a>}</span></h4>
<h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">(label<span class="signature-attributes">opt</span>, where<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="OGMNeoQuery.html">OGMNeoQuery</a>}</span></h4>



Expand Down Expand Up @@ -2055,7 +2055,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
6 changes: 3 additions & 3 deletions docs/OGMNeoWhere.html
Expand Up @@ -309,7 +309,7 @@ <h3 class="subsection-title">Methods</h3>



<h4 class="name" id=".where"><span class="type-signature">(static) </span>where<span class="signature">(property<span class="signature-attributes">opt</span>, filter)</span><span class="type-signature"> &rarr; {<a href="OGMNeoWhere.html">OGMNeoWhere</a>}</span></h4>
<h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">(property<span class="signature-attributes">opt</span>, filter)</span><span class="type-signature"> &rarr; {<a href="OGMNeoWhere.html">OGMNeoWhere</a>}</span></h4>



Expand Down Expand Up @@ -1059,7 +1059,7 @@ <h3 class="subsection-title">Methods</h3>



<h4 class="name" id=".where"><span class="type-signature">(static) </span>where<span class="signature">(property<span class="signature-attributes">opt</span>, filter)</span><span class="type-signature"> &rarr; {<a href="OGMNeoWhere.html">OGMNeoWhere</a>}</span></h4>
<h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">(property<span class="signature-attributes">opt</span>, filter)</span><span class="type-signature"> &rarr; {<a href="OGMNeoWhere.html">OGMNeoWhere</a>}</span></h4>



Expand Down Expand Up @@ -1627,7 +1627,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/OGMRelation.html
Expand Up @@ -2264,7 +2264,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Expand Up @@ -56,7 +56,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/ogmneo-cypher.js.html
Expand Up @@ -94,7 +94,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
54 changes: 35 additions & 19 deletions docs/ogmneo-index.js.html
Expand Up @@ -39,48 +39,64 @@ <h1 class="page-title">Source: ogmneo-index.js</h1>
*
* @static
* @param {string} label - Label where to create the index.
* @param {array} fields - The fields where to create the index. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0
* @param {array|string} properties - The array fields where to create the index or in case of only a string name of the property. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0
* @returns {Promise&lt;object|Error>} Neo4j result object if fulfilled, or some neo4j error if rejected.
*/
static create(label, fields) {
return this._index(label, fields, 'CREATE');
}

/**
* Drops properties index on neo4j.
*
* @static
* @param {string} label - Label where to create the index.
* @param {array} fields - The fields where to create the index. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0
* @param {string} label - Label where to drop the index.
* @param {array|string} properties - The array fields where to drop the index or in case of only a string name of the property. Must be an string array. OBS: More than one parameter you be accepted only on neo4j 3.2.0
* @returns {Promise&lt;object|Error>} Neo4j result object if fulfilled, or some neo4j error if rejected.
*/
static drop(label, fields) {
return this._index(label, fields, 'DROP');
static drop(label, properties) {
return this._index(label, properties, 'DROP');
}

static _index(label, fields, operation) {
static _index(label, properties, operation) {
return new Promise((resolve, reject) => {
//Check for valid types on parameters
if (_.isString(label) &amp;&amp; _.isArray(fields)) {
let validFields = fields.filter( field => _.isString(field));
if (_.isEmpty(validFields)) {
reject(new Error('You must provide an array with at least one field name string'));
} else {
let fieldQuery = validFields.reduce((result, current) => {
return (result === '') ? `${current}` : `,${current}`;
}, '');
let cypher = `${operation} INDEX ON :${label}(${fieldQuery})`;
//Check for valid types on parameters
if (_.isString(label)) {
let fieldParam = this._propertyParam(properties);
if (fieldParam) {
let cypher = `${operation} INDEX ON :${label} ${fieldParam}`;
OGMCypher.execute(cypher).then((result) => {
resolve(result);
}).catch((error) => {
reject(error);
});
} else {
reject(new Error('You must provide and label and an array with at least one field name or a string name'));
}
} else {
reject(new Error('You must provide and label and an array with at least one field name'));
reject(new Error('You must provide and string as label param'));
}
});
}

static _propertyParam(properties) {
if (properties != null) {
if (_.isString(properties)) {
return !_.isEmpty(properties) ? `(${properties})` : null;
} else if (_.isArray(properties)) {
let validProperties = properties.filter(field => _.isString(field));
if (_.isEmpty(validProperties)) {
return null;
} else {
let fieldQuery = properties.reduce((result, current) => {
return (result === '') ? `${current}` : `,${current}`;
}, '');
return `(${fieldQuery})`;
}
}
}
return null;
}
}

module.exports = OGMNeoIndex;</code></pre>
Expand All @@ -99,7 +115,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/ogmneo-node.js.html
Expand Up @@ -433,7 +433,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions docs/ogmneo-query.js.html
Expand Up @@ -58,7 +58,7 @@ <h1 class="page-title">Source: ogmneo-query.js</h1>
* @param {OGMNeoWhere} [where=null] - Optional WHERE clause filter for query.
* @returns {OGMNeoQuery} Created query with label.
*/
static query(label, where = null, limit = null) {
static create(label, where = null, limit = null) {
return new OGMNeoQuery(label, where, limit);
}

Expand Down Expand Up @@ -156,7 +156,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/ogmneo-relation.js.html
Expand Up @@ -345,7 +345,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions docs/ogmneo-where.js.html
Expand Up @@ -59,7 +59,7 @@ <h1 class="page-title">Source: ogmneo-where.js</h1>
Possible filters are: $eq(equals), $lt(lessThan),$lte(lessThanOrEqual), $gt(greaterThan), $gte(greaterThanOrEqual), $ne(not equals) and for string properties $regex, $startswith, $endswith and $contains.
* @returns {OGMNeoWhere} Created query with label.
*/
static where(property, filter) {
static create(property, filter) {
return new OGMNeoWhere(property, filter);
}

Expand Down Expand Up @@ -195,7 +195,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/ogmneo.js.html
Expand Up @@ -114,7 +114,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OGMNeo.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri May 26 2017 22:04:32 GMT-0300 (-03)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 00:30:02 GMT-0300 (-03)
</footer>

<script> prettyPrint(); </script>
Expand Down

0 comments on commit 2132776

Please sign in to comment.