File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,10 @@ import * as journalize from 'journalize';
8484 - [ Examples] ( #examples-8 )
8585- [ widont] ( #widont )
8686 - [ Parameters] ( #parameters-9 )
87+ - [ Examples] ( #examples-9 )
8788- [ yesno] ( #yesno )
8889 - [ Parameters] ( #parameters-10 )
89- - [ Examples] ( #examples-9 )
90+ - [ Examples] ( #examples-10 )
9091
9192### apdate
9293
@@ -338,6 +339,18 @@ character.
338339- ` val ` ** [ string] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String ) **
339340- ` replaceChar ` ** [ string] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String ) ** The character to replace the space with (optional, default ` '\xA0' ` )
340341
342+ #### Examples
343+
344+ ``` javascript
345+ var journalize = require (' journalize' );
346+
347+ journalize .widont (' this is a string' );
348+ // returns 'this is a string'
349+
350+ journalize .widont (' this is a string' , ' HELLO' );
351+ // returns 'this is aHELLOstring'
352+ ```
353+
341354Returns ** [ string] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String ) **
342355
343356### yesno
Original file line number Diff line number Diff line change @@ -25,6 +25,16 @@ const widontRegex = new RegExp(/\s+([^\s]*)\s*$/);
2525 * @param {string } val
2626 * @param {string } [replaceChar='\xA0'] The character to replace the space with
2727 * @returns {string }
28+ * @example
29+ *
30+ * var journalize = require('journalize');
31+ *
32+ * journalize.widont('this is a string');
33+ * // returns 'this is a string'
34+ *
35+ * journalize.widont('this is a string', 'HELLO');
36+ * // returns 'this is aHELLOstring'
37+ *
2838 */
2939export default function widont ( val , replaceChar = nbsp ) {
3040 // if `val` is undefined or null, return an empty string
You can’t perform that action at this time.
0 commit comments