96 lines
3.1 KiB
JavaScript
96 lines
3.1 KiB
JavaScript
|
|
/**
|
||
|
|
* Returns input or default value if input is falsey or empty
|
||
|
|
* @method jibo.animdb.Utils#parseString
|
||
|
|
* @static
|
||
|
|
* @param {string} input
|
||
|
|
* @param {string} defaultVal
|
||
|
|
* @returns {string}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Returns input or default value if input is falsey or empty
|
||
|
|
* @method jibo.animdb.Utils#parseNumber
|
||
|
|
* @static
|
||
|
|
* @param {string} input
|
||
|
|
* @param {number} defaultVal
|
||
|
|
* @returns {string}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Parses input string to SemVer object
|
||
|
|
* @method jibo.animdb.Utils#parseSemVer
|
||
|
|
* @static
|
||
|
|
* @param {string} input
|
||
|
|
* @returns {jibo.animdb#SemVer}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Retrieves all animations from a list that match a certain
|
||
|
|
* duration criteria
|
||
|
|
* @method jibo.animdb.Utils#getAnimationsByQuery
|
||
|
|
* @static
|
||
|
|
* @param {jibo.animdb.Animation[]} animations Input animation collection
|
||
|
|
* @param {jibo.animdb.AnimResults} interimResults
|
||
|
|
* @param {jibo.animdb#AnimQuery} [query] Selection criteria
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Checks if animation matches audio requirement
|
||
|
|
* @method jibo.animdb.Utils#audioMatch
|
||
|
|
* @static
|
||
|
|
* @param {jibo.animdb.Animation} animation
|
||
|
|
* @param {jibo.animdb#HasAudio} shouldHaveAudio
|
||
|
|
* @returns {boolean}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Checks if animation matches category criteria
|
||
|
|
* @method jibo.animdb.Utils#catMatch
|
||
|
|
* @static
|
||
|
|
* @param {jibo.animdb.Animation} animation
|
||
|
|
* @param {string[]} allOfCat -- List of categories that the animation must be a part of
|
||
|
|
* @param {string[]} someOfCat -- List of categories that the animation should be a part of at least one of
|
||
|
|
* @param {string[]} noneOfCat -- List of categories that the animation must not be a part of
|
||
|
|
* @returns {boolean}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Checks if animation matches meta tag criteria
|
||
|
|
* @method jibo.animdb.Utils#metaMatch
|
||
|
|
* @static
|
||
|
|
* @param {jibo.animdb.Animation} animation
|
||
|
|
* @param {string[]} allOfMeta -- List of meta that the animation must contain
|
||
|
|
* @param {string[]} someOfMeta -- List of meta that the animation must contain at least one of
|
||
|
|
* @param {string[]} noneOfMeta -- List of meta that the animation must not contain
|
||
|
|
* @returns {boolean}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds animation to result if duration matches bounds
|
||
|
|
* @method jibo.animdb.Utils#addIfDurationMatch
|
||
|
|
* @static
|
||
|
|
* @param {jibo.animdb.Animation} animation
|
||
|
|
* @param {number} duration
|
||
|
|
* @param {number} durationError
|
||
|
|
* @param {jibo.animdb.AnimResults} res
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Takes a number and limits it by this range.
|
||
|
|
* If min then return min bound, if higher then return max bound
|
||
|
|
* @method jibo.animdb.Utils#limitToRange
|
||
|
|
* @static
|
||
|
|
* @param {number} num
|
||
|
|
* @param {number[]} range [min, max]
|
||
|
|
* @returns {number}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Reports how far a number is from being within this range
|
||
|
|
* Returns 0 if it is contained in range
|
||
|
|
* @method jibo.animdb.Utils#distanceFromRange
|
||
|
|
* @static
|
||
|
|
* @param {number} num
|
||
|
|
* @param {number[]} range [min, max]
|
||
|
|
* @returns {number}
|
||
|
|
*/
|