-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from nicolasembleton/upstream
Update Package.json dependencies, according tests, activate solrVersion, facet.pivot, add helpers for standardization
- Loading branch information
Showing
20 changed files
with
431 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
# CONTRIBUTIONS | ||
|
||
Send a pull request with your code and the tests for it. | ||
The library lives and prospers thanks to you. If you want to share some of your work, or if you have fixed some of the | ||
open issues, send a pull request with your code and the tests for it. | ||
|
||
Not mandatory at all but if you don't mind: | ||
We're currently re-organizing the project organization, and as such we're starting to adopt a stricter commit guideline, | ||
very much inspired from that of [AngularJS](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) | ||
|
||
* Prepend your commit message with `FIX:` or `NEW:`, make it easy to generate a readable CHANGELOG. | ||
So we ask you to respect 2 rules: | ||
1. Provide the code, the tests, all respecting the style guide | ||
2. Follow AngularJS commit style-guide that can, at the most minimum, be summarized by a single line like: | ||
`feat(solrCloud): Add ability to query pivot per field` | ||
|
||
Note: Please restrain from committing code that does other changes than what they are committed for. Avoid changing the | ||
style guide of entire files while committing fixes or features. | ||
|
||
*Thanks in advance for your support in making the library live.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* | ||
* @param value | ||
* @param defaultIfNull - Will set the value to the default if it is Null or Undefined | ||
* @returns {*[]} | ||
*/ | ||
exports.toArray = function toArray(value, defaultIfNull) { | ||
defaultIfNull = defaultIfNull || ''; | ||
|
||
function defaultValue(value) { | ||
return (value === null || value === undefined) ? defaultIfNull : value; | ||
} | ||
|
||
return (Array.isArray(value)) ? value : [defaultValue(value)]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* | ||
* @param value - The value to check against | ||
* @param strict - Pass true if you want to make sure the number is fully and only composed of digits, false to just check if we can extract a number via parseInt(). Default to true. | ||
* @returns boolean | ||
*/ | ||
exports.isNumber = function isNumber(value, strict) { | ||
strict = (strict === undefined ? true : strict); | ||
var digitRegex = /^\-?\d+$/; // At least 1 digit, possibly a minus sign before | ||
|
||
if (typeof value === 'number') { | ||
return true; | ||
} else { | ||
// String ? | ||
if (strict) { | ||
return (('' + value).match(digitRegex) !== null); | ||
} else { | ||
return !isNaN(parseInt(value)); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* The purpose of those helpers is to centralize and standardize the work on detecting current running Solr Version | ||
*/ | ||
|
||
var Solr3_2 = 302; | ||
var Solr4_0 = 400; | ||
var Solr5_0 = 500; | ||
var Solr5_1 = 501; | ||
|
||
/** | ||
* Enum that lists supported versions of Solr. Pass one of the keys from this enum as a solrVersion property | ||
* | ||
* @type {{3.2: number, 4.0: number, 5.0: number, 5.1: number}} | ||
*/ | ||
var versionsEnum = { | ||
'3.2': Solr3_2, | ||
'4.0': Solr4_0, | ||
'5.0': Solr5_0, | ||
'5.1': Solr5_1 | ||
}; | ||
|
||
exports.versionsEnum = versionsEnum; | ||
exports.Solr3_2 = Solr3_2; | ||
exports.Solr4_0 = Solr4_0; | ||
exports.Solr5_0 = Solr5_0; | ||
exports.Solr5_1 = Solr5_1; | ||
|
||
/** | ||
* solrVersion must match one of enum keys | ||
* If a number is passed, it'll be assume a .0 release (3 -> 3.0) | ||
* If nothing matches, it will be assumed 3.2 | ||
* | ||
* @param solrVersion | ||
*/ | ||
exports.version = function(solrVersion) { | ||
return (typeof solrVersion === "number") ? (versionsEnum[''+solrVersion+'.0']) : (versionsEnum[solrVersion] ? versionsEnum[solrVersion] : versionsEnum['3.2']); | ||
}; |
Oops, something went wrong.