UNPKG

seeq

Version:

Search or detect name on some resource (GitHub, NPM, Bower, ...)

1,651 lines (566 loc) 23.3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>seeq Module: resource/util</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.spacelab.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">seeq</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="module-bower.html">bower</a></li><li><a href="module-cdnjs.html">cdnjs</a></li><li><a href="module-cli.html">cli</a></li><li><a href="module-format.html">format</a></li><li><a href="module-format_util.html">format/util</a></li><li><a href="module-github.html">github</a></li><li><a href="module-grunt.html">grunt</a></li><li><a href="module-gulp.html">gulp</a></li><li><a href="module-json.html">json</a></li><li><a href="module-jster.html">jster</a></li><li><a href="module-markdown.html">markdown</a></li><li><a href="module-microjs.html">microjs</a></li><li><a href="module-npm.html">npm</a></li><li><a href="module-raw.html">raw</a></li><li><a href="module-resource.html">resource</a></li><li><a href="module-resource_util.html">resource/util</a></li><li><a href="module-seeq.html">seeq</a></li><li><a href="module-text.html">text</a></li><li><a href="module-webcomponents.html">webcomponents</a></li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="module-resource_util-FailedHttpRequestError.html">resource/util~FailedHttpRequestError</a></li><li><a href="module-resource_util-IncorrectResponseError.html">resource/util~IncorrectResponseError</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content"> <div class="row"> <div class="col-md-8"> <div id="main"> <h1 class="page-title">Module: resource/util</h1> <section> <header> </header> <article> <div class="container-overview"> <div class="description">Helper functions.</div> <dl class="details"> </dl> </div> <h3 class="subsection-title">Classes</h3> <dl> <dt><a href="module-resource_util-FailedHttpRequestError.html">FailedHttpRequestError</a></dt> <dd></dd> <dt><a href="module-resource_util-IncorrectResponseError.html">IncorrectResponseError</a></dt> <dd></dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id=".decodeHtmlEntity"><span class="type-signature">&lt;static> </span>decodeHtmlEntity(str)</h4> </dt> <dd> <div class="description"> Decode HTML entities in given string. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>str</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">String that should be processed.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> Decoded string. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getHttpRequestError"><span class="type-signature">&lt;static> </span>getHttpRequestError(err, response)</h4> </dt> <dd> <div class="description"> Return object that represents data about error of HTTP request. <br> If <code>err</code> parameter is set then it will be returned. Otherwise instance of FailedHttpRequestError will be returned. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>err</code></td> <td class="type"> <span class="param-type">Error</span> </td> <td class="description last">Represents data about error.</td> </tr> <tr> <td class="name"><code>response</code></td> <td class="type"> <span class="param-type">http.IncomingMessage</span> </td> <td class="description last">Represents data about response.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> Error object. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getLimit"><span class="type-signature">&lt;static> </span>getLimit( [settings] [, defaultValue] [, maxValue])</h4> </dt> <dd> <div class="description"> Return value of <code>limit</code> setting. Default value will be returned if <code>limit</code> field is not present in <code>settings</code> parameter. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>settings</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Operation settings. The object can have numeric <code>limit</code> field which value will be returned if the value is positive number and not greater than maximum value. Otherwise value of <code>defaultValue</code> parameter will be returned.</td> </tr> <tr> <td class="name"><code>defaultValue</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Default value of limit. <code>maxValue</code> is used when parameter value is not passed or 0.</td> </tr> <tr> <td class="name"><code>maxValue</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Maximum value of limit. <code>Number.MAX_VALUE</code> is used when parameter value is not passed.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> Value that corresponds to <code>limit</code> setting. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getRequestSettings"><span class="type-signature">&lt;static> </span>getRequestSettings( [settings] [, json])</h4> </dt> <dd> <div class="description"> Return request settings. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>settings</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last">Operation settings. The following settings are used to form request settings (name - type - description): <ul> <li><code>requestTimeout</code> - <code>Integer</code> - Number of milliseconds to wait for a response before aborting a data request </ul></td> </tr> <tr> <td class="name"><code>json</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last">Whether the setting to process response as JSON should be added.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> Request settings. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".isRealSearchSet"><span class="type-signature">&lt;static> </span>isRealSearchSet( [settings])</h4> </dt> <dd> <div class="description"> Determine whether search should be made instead of check according to operation settings. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>settings</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Operation settings. The following settings are used to specify real search (name - type - description): <ul> <li><code>search</code> - <code>Boolean</code> - Whether search should be made instead of check </ul></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <code>true</code> if real search should be made according to settings, <code>false</code> otherwise. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".isSearchSet"><span class="type-signature">&lt;static> </span>isSearchSet( [settings])</h4> </dt> <dd> <div class="description"> Check whether search should be made according to operation settings. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>settings</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Operation settings. The following settings are used to specify search (name - type - description): <ul> <li><code>caseSensitive</code> - <code>Boolean</code> - Whether case-sensitive check/search should be used <li><code>partialMatch</code> - <code>Integer</code> - Allow partial matching: 0 - disallow (by default), 1 - allow at the beginning of matching strings, 2 - allow substring matching <li><code>search</code> - <code>Boolean</code> - Whether search should be made instead of check </ul></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <code>true</code> if search should be made according to settings, <code>false</code> otherwise. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".isStringMatch"><span class="type-signature">&lt;static> </span>isStringMatch(value, searchValue [, settings])</h4> </dt> <dd> <div class="description"> Check whether one of given strings is similar to the searched string. </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">Array</span> | <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">String or array of strings that should be checked.</td> </tr> <tr> <td class="name"><code>searchValue</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">Value that is searched for.</td> </tr> <tr> <td class="name"><code>settings</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Operation settings. The following settings are supported (name - type - description): <ul> <li><code>caseSensitive</code> - <code>Boolean</code> - Whether case-sensitive check should be used <li><code>partialMatch</code> - <code>Integer</code> - Allow partial matching: 0 - disallow (by default), 1 - allow at the beginning of matching strings, 2 - allow substring matching <li><code>search</code> - <code>Boolean</code> - Whether search should be made instead of check </ul></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <code>true</code> if one of given strings is similar to the searched string according to settings, <code>false</code> otherwise. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </dd> </dl> </article> </section> </div> </div> <div class="clearfix"></div> <div class="col-md-3"> <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div> </div> </div> </div> <div class="modal fade" id="searchResults"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Search results</h4> </div> <div class="modal-body"></div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div> <footer> <span class="copyright"> Copyright (c) 2014-2020 Denis Sikuler </span> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on 2020-03-08T01:34:36+03:00 using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. </span> </footer> <script src="scripts/docstrap.lib.js"></script> <script src="scripts/toc.js"></script> <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script> <script> $( function () { $( "[id*='$']" ).each( function () { var $this = $( this ); $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) ); } ); $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html( exampleText ); lang = lang[1]; } else { var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch[1] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide : false, smoothScrolling: true } ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); $( '.dropdown-toggle' ).dropdown(); $( "table" ).each( function () { var $this = $( this ); $this.addClass('table'); } ); } ); </script> <!--Navigation and Symbol Display--> <!--Google Analytics--> <script type="text/javascript"> $(document).ready(function() { SearcherDisplay.init(); }); </script> </body> </html>