node-query/docs/helpers.js.html

110 lines
2.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: helpers.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: helpers.js</h1>
<section>
<article>
<pre class="prettyprint source"><code>/** @module helpers */
"use strict";
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
configurable: false,
writable: false,
value: function (searchString, position) {
position = position || 0;
return this.lastIndexOf(searchString, position) === position;
}
});
}
if (!String.prototype.endsWith) {
Object.defineProperty(String.prototype, 'endsWith', {
value: function (searchString, position) {
var subjectString = this.toString();
if (position === undefined || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
}
});
}
module.exports = {
/**
* Split a string by a character, trim the string
* and rejoin the string
*
* @param {String} char
* @param {String} string
* @return {String}
*/
splitTrim: function(char, string) {
return string.split(char).map(String.trim).join(char);
},
/**
* Determine whether an object is a string
* @param {mixed} obj
* @return {bool}
*/
isString: function(obj) {
return (typeof obj === 'string' || obj instanceof String);
},
/**
* Determine whether an object is numeric
* @param {mixed} obj
* @return {bool}
*/
isNumber: function(obj) {
return ! isNaN(parseFloat(obj)) && isFinite(obj);
}
};
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-driver.html">driver</a></li><li><a href="module-helpers.html">helpers</a></li><li><a href="module-query-builder.html">query-builder</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Oct 20 2014 16:34:02 GMT-0400 (EDT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>