{
  "name": "string",
  "version": "2.1.0",
  "description": "string contains methods that aren't included in the vanilla JavaScript string such as escaping html, decoding html entities, stripping tags, etc.",
  "homepage": "http://stringjs.com",
  "repository": {
    "type": "git",
    "url": "https://github.com/jprichardson/string.js"
  },
  "keywords": [
    "string",
    "strings",
    "string.js",
    "stringjs",
    "S",
    "s",
    "csv",
    "html",
    "entities",
    "parse",
    "html",
    "tags",
    "strip",
    "trim",
    "encode",
    "decode",
    "escape",
    "unescape"
  ],
  "author": {
    "name": "JP Richardson",
    "email": "jprichardson@gmail.com"
  },
  "licenses": [
    {
      "type": "MIT"
    }
  ],
  "dependencies": {},
  "devDependencies": {
    "mocha": "*",
    "uglify-js": "1.3.x",
    "istanbul": "*"
  },
  "main": "lib/string",
  "scripts": {
    "test": "mocha test",
    "istanbul": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha test/string.test.js"
  },
  "readme": "[string.js](http://stringjs.com)\n=========\n\n[![build status](https://secure.travis-ci.org/jprichardson/string.js.png)](http://travis-ci.org/jprichardson/string.js)\n\n`string.js`, or simply `S` is a lightweight (**< 5 kb** minified and gzipped) JavaScript library for the browser or for Node.js that provides extra String methods. Originally, it modified the String prototype. But I quickly learned that in JavaScript, this is considered poor practice.\n\n\n\nWhy?\n----\n\nPersonally, I prefer the cleanliness of the way code looks when it appears to be native methods. i.e. when you modify native JavaScript prototypes. However, if any app dependency required `string.js`, then the app's string prototype would be modified in every module. This could be troublesome. So I settled on creating a wrapper a la jQuery style. For those of you prototype hatin' fools, there is the method `extendPrototype()`.\n\nHere's a list of alternative frameworks:\n\n* [Prototype Framework's String library](http://prototypejs.org/api/string)\n* [Uize.String](http://www.uize.com/reference/Uize.String.html)\n* [Google Closure's String](http://closure-library.googlecode.com/svn/docs/namespace_goog_string.html)\n* [Underscore.string](http://epeli.github.com/underscore.string/)\n* [Sugar.js](http://sugarjs.com)\n* [php.js](http://phpjs.org/pages/home)\n\nWhy wasn't I happy with any of them? They are all static methods that don't seem to support chaining in a clean way 'OR' they have an odd dependency. Sugar is the notable exception.\n\n\n\nInstallation\n------------\n\n    npm install --save string\n\n\n\nExperiment with String.js Now\n-----------------------------\n\nAssuming you're on http://stringjs.com, just simply open up the Webkit inspector in either Chrome or Safari, or the web console in Firefox and you'll notice that `string.js` is included in this page so that you can start experimenting with it right away.\n\n\n\nUsage\n-----\n\n### Node.js\n\n```javascript\nvar S = require('string');\n```\n\nOriginally, I was using `$s` but glancing over the code, it was easy to confuse `$s` for string.js with `$` for jQuery. Feel free to use the most convenient variable for you.\n\n\n### Rails\n\nCheckout this gem to easily use string.js on the asset pipeline: https://github.com/jesjos/stringjs-rails\n\n\n\n### Browsers\n\n```html\n<!-- HTML5 -->\n<script src=\"https://cdn.rawgit.com/jprichardson/string.js/master/lib/string.min.js\"></script>\n\n<!-- Note that in the mime type for Javascript is now officially 'application/javascript'. If you\nset the type to application/javascript in IE browsers, your Javscript will fail. Just don't set a\ntype via the script tag and set the mime type from your server. Most browsers look at the server mime\ntype anyway -->\n\n<!-- For HTML4/IE -->\n<script type=\"text/javascript\" src=\"https://cdn.rawgit.com/jprichardson/string.js/master/lib/string.min.js\"></script>\n```\n\nA global variable `window.S` or simply `S` is created.\n\n\n### AMD Support\n\nIt now [has AMD support](https://github.com/jprichardson/string.js/pull/20). See [require.js](http://requirejs.org/) on how to use with AMD modules.\n\n\n### Both\n\n```javascript\nvar doesIt = S('my cool string').left(2).endsWith('y'); //true\n```\n\nAccess the wrapped string using `s` variable or `toString()`\n\n```javascript\nvar name = S('Your name is JP').right(2).s; //'JP'\n```\n\nis the same as…\n\n```javascript\nvar name = S('Your name is JP').right(2).toString(); //'JP'\n```\n\nStill like the clean look of calling these methods directly on native Strings? No problem. Call `extendPrototype()`. Make sure to not call this at the module level, at it'll effect the entire application lifecycle. You should really only use this at the method level. The one exception being if your application will not be a dependency of another application.\n\n```javascript\nS.extendPrototype();\nvar name = 'Your name is JP'.right(2); //'JP'\nS.restorePrototype(); //be a good citizen and clean up\n```\n\n\n### Browser Compatiblity\n\n`string.js` has been designed to be compatible with Node.js and with IE6+, Firefox 3+, Safari 2+, Chrome 3+. Please [click here][browsertest] to run the tests in your browser. Report any browser issues here: https://github.com/jprichardson/string.js/issues\n\n\n### Extending string.js\n\nSee: https://github.com/jprichardson/string.js/pull/57\n\n\n\nNative JavaScript Methods\n-------------------------\n\n`string.js` imports all of the native JavaScript methods. This is for convenience. The only difference is that the imported methods return `string.js` objects instead of native JavaScript strings. The one exception to this is the method `charAt(index)`. This is because `charAt()` only returns a string of length one. This is typically done for comparisons and a `string.js` object will have little to no value here.\n\nAll of the native methods support chaining with the `string.js` methods.\n\n**Example:**\n\n```javascript\nvar S = require('string');\n\nvar phrase = S('JavaScript is the best scripting language ever!');\nvar sub = 'best scripting';\nvar pos = phrase.indexOf(sub);\nconsole.log(phrase.substr(pos, sub.length).truncate(8)); //best...\n```\n\n\nMethods\n-------\n\nSee [test file][testfile] for more details.\n\nI use the same nomenclature as Objective-C regarding methods. **+** means `static` or `class` method. **-** means `non-static` or `instance` method.\n\n### - constructor(nativeJsString) ###\n\nThis creates a new `string.js` object. The parameter can be anything. The `toString()` method will be called on any objects. Some native objects are used in some functions such as `toCSV()`.\n\nExample:\n\n```javascript\nS('hello').s //\"hello\"\nS(['a,b']).s //\"a,b\"\nS({hi: 'jp'}).s //\"[object Object]\"\"\n```\n\n\n### - between(left, right)\n\nExtracts a string between `left` and `right` strings.\n\nExample:\n\n```javascript\nS('<a>foo</a>').between('<a>', '</a>').s // => 'foo'\nS('<a>foo</a></a>').between('<a>', '</a>').s // => 'foo'\nS('<a><a>foo</a></a>').between('<a>', '</a>').s // => '<a>foo'\nS('<a>foo').between('<a>', '</a>').s // => ''\nS('Some strings } are very {weird}, dont you think?').between('{', '}').s // => 'weird'\nS('This is a test string').between('test').s // => ' string'\nS('This is a test string').between('', 'test').s // => 'This is a '\n```\n\n### - camelize()\n\nRemove any underscores or dashes and convert a string into camel casing.\n\nExample:\n\n```javascript\nS('data_rate').camelize().s; //'dataRate'\nS('background-color').camelize().s; //'backgroundColor'\nS('-moz-something').camelize().s; //'MozSomething'\nS('_car_speed_').camelize().s; //'CarSpeed'\nS('yes_we_can').camelize().s; //'yesWeCan'\n```\n\n\n### - capitalize() ###\n\nCapitalizes the first character of a string.\n\nExample:\n\n```javascript\nS('jon').capitalize().s; //'Jon'\nS('JP').capitalize().s; //'Jp'\n```\n\n\n### - chompLeft(prefix)\n\nRemoves `prefix` from start of string.\n\nExample:\n\n```javascript\nS('foobar').chompLeft('foo').s; //'bar'\nS('foobar').chompLeft('bar').s; //'foobar'\n```\n\n\n### - chompRight(suffix)\n\nRemoves `suffix` from end of string.\n\nExample:\n\n```javascript\nS('foobar').chompRight('bar').s; //'foo'\nS('foobar').chompRight('foo').s; //'foobar'\n```\n\n\n### - collapseWhitespace() ###\n\nConverts all adjacent whitespace characters to a single space.\n\nExample:\n\n```javascript\nvar str = S('  String   \\t libraries are   \\n\\n\\t fun\\n!  ').collapseWhitespace().s; //'String libraries are fun !'\n```\n\n\n### - contains(ss) ###\n\nReturns true if the string contains `ss`.\n\nAlias: `include()`\n\nExample:\n\n```javascript\nS('JavaScript is one of the best languages!').contains('one'); //true\n```\n\n\n### - count(substring) ###\n\nReturns the count of the number of occurrences of the substring.\n\nExample:\n\n```javascript\nS('JP likes to program. JP does not play in the NBA.').count(\"JP\")// 2\nS('Does not exist.').count(\"Flying Spaghetti Monster\") //0\nS('Does not exist.').count(\"Bigfoot\") //0\nS('JavaScript is fun, therefore Node.js is fun').count(\"fun\") //2\nS('funfunfun').count(\"fun\") //3\n```\n\n\n### - dasherize() ###\n\nReturns a converted camel cased string into a string delimited by dashes.\n\nExamples:\n\n```javascript\nS('dataRate').dasherize().s; //'data-rate'\nS('CarSpeed').dasherize().s; //'-car-speed'\nS('yesWeCan').dasherize().s; //'yes-we-can'\nS('backgroundColor').dasherize().s; //'background-color'\n```\n\n\n### - decodeHTMLEntities() ###\n\nDecodes HTML entities into their string representation.\n\n```javascript\nS('Ken Thompson &amp; Dennis Ritchie').decodeHTMLEntities().s; //'Ken Thompson & Dennis Ritchie'\nS('3 &lt; 4').decodeHTMLEntities().s; //'3 < 4'\n```\n\n\n### - endsWith(ss) ###\n\nReturns true if the string ends with `ss`.\n\nExample:\n\n```javascript\nS(\"hello jon\").endsWith('jon'); //true\n```\n\n\n### - escapeHTML() ###\n\nEscapes the html.\n\nExample:\n\n```javascript\nS('<div>hi</div>').escapeHTML().s; //&lt;div&gt;hi&lt;/div&gt;\n```\n\n\n### + extendPrototype() ###\n\nModifies `String.prototype` to have all of the methods found in string.js.\n\nExample:\n\n```javascript\nS.extendPrototype();\n```\n\n\n\n### - ensureLeft(prefix)\n\nEnsures string starts with `prefix`.\n\nExample:\n\n```javascript\nS('subdir').ensureLeft('/').s; //'/subdir'\nS('/subdir').ensureLeft('/').s; //'/subdir'\n```\n\n\n### - ensureRight(suffix)\n\nEnsures string ends with `suffix`.\n\nExample:\n\n```javascript\nS('dir').ensureRight('/').s; //'dir/'\nS('dir/').ensureRight('/').s; //'dir/'\n```\n\n### - humanize() ###\n\nTransforms the input into a human friendly form.\n\nExample:\n\n```javascript\nS('the_humanize_string_method').humanize().s  //'The humanize string method'\nS('ThehumanizeStringMethod').humanize().s //'Thehumanize string method'\nS('the humanize string method').humanize().s  //'The humanize string method'\nS('the humanize_id string method_id').humanize().s //'The humanize id string method'\nS('the  humanize string method  ').humanize().s //'The humanize string method'\nS('   capitalize dash-CamelCase_underscore trim  ').humanize().s //'Capitalize dash camel case underscore trim'\n```\n\n### - include(ss) ###\n\nReturns true if the string contains the `ss`.\n\nAlias: `contains()`\n\nExample:\n\n```javascript\nS('JavaScript is one of the best languages!').include('one'); //true\n```\n\n\n### - isAlpha() ###\n\nReturn true if the string contains only letters.\n\nExample:\n\n```javascript\nS(\"afaf\").isAlpha(); //true\nS('fdafaf3').isAlpha(); //false\nS('dfdf--dfd').isAlpha(); //false\n```\n\n\n### - isAlphaNumeric() ###\n\nReturn true if the string contains only letters and numbers\n\nExample:\n\n```javascript\nS(\"afaf35353afaf\").isAlphaNumeric(); //true\nS(\"FFFF99fff\").isAlphaNumeric(); //true\nS(\"99\").isAlphaNumeric(); //true\nS(\"afff\").isAlphaNumeric(); //true\nS(\"Infinity\").isAlphaNumeric(); //true\nS(\"-Infinity\").isAlphaNumeric(); //false\nS(\"-33\").isAlphaNumeric(); //false\nS(\"aaff..\").isAlphaNumeric(); //false\n```\n\n\n### - isEmpty() ###\n\nReturn true if the string is solely composed of whitespace or is `null`/`undefined`.\n\nExample:\n\n```javascript\nS(' ').isEmpty(); //true\nS('\\t\\t\\t    ').isEmpty(); //true\nS('\\n\\n ').isEmpty(); //true\nS('helo').isEmpty(); //false\nS(null).isEmpty(); //true\nS(undefined).isEmpty(); //true\n```\n\n\n### - isLower() ###\n\nReturn true if the character or string is lowercase\n\nExample:\n\n```javascript\nS('a').isLower(); //true\nS('z').isLower(); //true\nS('B').isLower(); //false\nS('hijp').isLower(); //true\nS('hi jp').isLower(); //false\nS('HelLO').isLower(); //false\n```\n\n\n### - isNumeric() ###\n\nReturn true if the string only contains digits\n\nExample:\n\n```javascript\nS(\"3\").isNumeric(); //true\nS(\"34.22\").isNumeric(); //false\nS(\"-22.33\").isNumeric(); //false\nS(\"NaN\").isNumeric(); //false\nS(\"Infinity\").isNumeric(); //false\nS(\"-Infinity\").isNumeric(); //false\nS(\"JP\").isNumeric(); //false\nS(\"-5\").isNumeric(); //false\nS(\"000992424242\").isNumeric(); //true\n```\n\n\n### - isUpper() ###\n\nReturns true if the character or string is uppercase\n\nExample:\n\n```javascript\nS('a').isUpper() //false\nS('z').isUpper()  //false\nS('B').isUpper() //true\nS('HIJP').isUpper() //true\nS('HI JP').isUpper() //false\nS('HelLO').isUpper() //true\n```\n\n\n### - latinise() ###\n\nRemoves accents from Latin characters.\n\n```javascript\nS('crème brûlée').latinise().s // 'creme brulee'\n```\n\n\n### - left(n) ###\n\nReturn the substring denoted by `n` positive left-most characters.\n\nExample:\n\n```javascript\nS('My name is JP').left(2).s; //'My'\nS('Hi').left(0).s; //''\nS('My name is JP').left(-2).s; //'JP', same as right(2)\n```\n\n\n### - length ###\n\nProperty to return the length of the string object.\n\nExample:\n\n```javascript\nS('hi').length; //2\n```\n\n### - lines() ####\n\nReturns an array with the lines. Cross-platform compatible.\n\nExample:\n\n```javascript\nvar stuff = \"My name is JP\\nJavaScript is my fav language\\r\\nWhat is your fav language?\"\nvar lines = S(stuff).lines()\n\nconsole.dir(lines) \n/*\n[ 'My name is JP',\n  'JavaScript is my fav language',\n  'What is your fav language?' ]\n*/\n```\n\n\n### - pad(len, [char])\n\nPads the string in the center with specified character. `char` may be a string or a number, defaults is a space. \n\nExample:\n\n```javascript\nS('hello').pad(5).s //'hello'\nS('hello').pad(10).s //'   hello  '\nS('hey').pad(7).s //'  hey  '\nS('hey').pad(5).s //' hey '\nS('hey').pad(4).s //' hey'\nS('hey').pad(7, '-').s//'--hey--'\n```\n\n\n### - padLeft(len, [char])\n\nLeft pads the string.\n\nExample:\n\n```javascript\nS('hello').padLeft(5).s //'hello'\nS('hello').padLeft(10).s //'     hello'\nS('hello').padLeft(7).s //'  hello'\nS('hello').padLeft(6).s //' hello'\nS('hello').padLeft(10, '.').s //'.....hello'\n```\n\n\n### - padRight(len, [char])\n\nRight pads the string.\n\nExample:\n\n```javascript\nS('hello').padRight(5).s //'hello'\nS('hello').padRight(10).s //'hello     '\nS('hello').padRight(7).s //'hello  '\nS('hello').padRight(6).s //'hello '\nS('hello').padRight(10, '.').s //'hello.....'\n```\n\n\n### - parseCSV() ###\n\nParses a CSV line into an array.\n\n**Arguments:**\n- `delimiter`: The character that is separates or delimits fields. Default: `,`\n- `qualifier`: The character that encloses fields. Default: `\"`\n- `escape`: The character that represents the escape character. Default: `\\`\n- `lineDelimiter`: The character that represents the end of a line. When a lineDelimiter is passed the result will be a multidimensional array. Default: `undefined`\n\nExample:\n\n```javascript\nS(\"'a','b','c'\").parseCSV(',', \"'\") //['a', 'b', 'c'])\nS('\"a\",\"b\",\"c\"').parseCSV() // ['a', 'b', 'c'])\nS('a,b,c').parseCSV(',', null)  //['a', 'b', 'c'])\nS(\"'a,','b','c'\").parseCSV(',', \"'\") //['a,', 'b', 'c'])\nS('\"a\",\"b\",4,\"c\"').parseCSV(',', null) //['\"a\"', '\"b\"', '4', '\"c\"'])\nS('\"a\",\"b\",\"4\",\"c\"').parseCSV() //['a', 'b', '4', 'c'])\nS('\"a\",\"b\",       \"4\",\"c\"').parseCSV() //['a', 'b', '4', 'c'])\nS('\"a\",\"b\",       4,\"c\"').parseCSV(\",\", null) //[ '\"a\"', '\"b\"', '       4', '\"c\"' ])\nS('\"a\",\"b\\\\\"\",\"d\",\"c\"').parseCSV() //['a', 'b\"', 'd', 'c'])\nS('\"a\",\"b\\\\\"\",\"d\",\"c\"').parseCSV() //['a', 'b\"', 'd', 'c'])\nS('\"a\\na\",\"b\",\"c\"\\n\"a\", \"\"\"b\\nb\", \"a\"').parseCSV(',', '\"', '\"', '\\n')) // [ [ 'a\\na', 'b', 'c' ], [ 'a', '\"b\\nb', 'a' ] ]\n```\n\n### - repeat(n) ###\n\nReturns a string repeated `n` times.\n\nAlias: `times()`\n\nExample:\n\n```javascript\nS(' ').repeat(5).s; //'     '\nS('*').repeat(3).s; //'***'\n```\n\n\n### - replaceAll(ss, newstr) ###\n\nReturn the new string with all occurrences of `ss` replaced with `newstr`.\n\nExample:\n\n```javascript\nS(' does IT work? ').replaceAll(' ', '_').s; //'_does_IT_work?_'\nS('Yes it does!').replaceAll(' ', '').s; //'Yesitdoes!'\n```\n\n\n### + restorePrototype() ###\n\nRestore the original String prototype. Typically used in conjunction with `extendPrototype()`.\n\nExample:\n\n```javascript\nS.restorePrototype();\n```\n\n\n### - right(n) ###\n\nReturn the substring denoted by `n` positive right-most characters.\n\nExample:\n\n```javascript\nS('I AM CRAZY').right(2).s; //'ZY'\nS('Does it work?  ').right(4).s; //'k?  '\nS('Hi').right(0).s; //''\nS('My name is JP').right(-2).s; //'My', same as left(2)\n```\n\n\n### - s ###\n\nAlias: `toString()`\n\nThe encapsulated native string representation of an `S` object.\n\nExample:\n\n```javascript\nS('my name is JP.').capitalize().s; //My name is JP.\nvar a = \"Hello \" + S('joe!'); //a = \"Hello joe!\"\nS(\"Hello\").toString() === S(\"Hello\").s; //true\n```\n\n\n### - setValue(value) ###\n\nSets the string to a `value`.\n\n```javascript\nvar myString = S('War');\nmyString.setValue('Peace').s; // 'Peace'\n```\n\n\n### - slugify() ###\n\nConverts the text into a valid url slug. Removes accents from Latin characters.\n\n```javascript\nS('Global Thermonuclear Warfare').slugify().s // 'global-thermonuclear-warfare'\nS('Crème brûlée').slugify().s // 'creme-brulee'\n```\n\n\n### - startsWith(prefix)   ###\n\nReturn true if the string starts with `prefix`.\n\nExample:\n\n```javascript\nS(\"JP is a software engineer\").startsWith(\"JP\"); //true\nS('wants to change the world').startsWith(\"politicians\"); //false\n```\n\n\n### - strip([string1],[string2],...) ###\n\nReturns a new string with all occurrences of `[string1],[string2],...` removed.\n\nExample:\n\n```javascript\nS(' 1 2 3--__--4 5 6-7__8__9--0').strip(' ', '_', '-').s; //'1234567890'\nS('can words also be stripped out?').strip('words', 'also', 'be').s; //'can    stripped out?'\n```\n\n\n### - stripPunctuation()\n\nStrip all of the punctuation.\n\nExample:\n\n```javascript\nS('My, st[ring] *full* of %punct)').stripPunctuation().s; //My string full of punct\n```\n\n\n\n### - stripTags([tag1],[tag2],...) ###\n\nStrip all of the HTML tags or tags specified by the parameters.\n\nExample:\n\n```javascript\nS('<p>just <b>some</b> text</p>').stripTags().s //'just some text'\nS('<p>just <b>some</b> text</p>').stripTags('p').s //'just <b>some</b> text'\n```\n\n\n### - template(values, [open], [close])\n\nTakes a string and interpolates the values. Defaults to `{{` and `}}` for Mustache compatible templates. However, you can change this default by modifying `S.TMPL_OPEN` and `S.TMPL_CLOSE`.\n\nExample:\n\n```js\nvar str = \"Hello {{name}}! How are you doing during the year of {{date-year}}?\"\nvar values = {name: 'JP', 'date-year': 2013}\nconsole.log(S(str).template(values).s) //'Hello JP! How are you doing during the year of 2013?'\n\nstr = \"Hello #{name}! How are you doing during the year of #{date-year}?\"\nconsole.log(S(str).template(values, '#{', '}').s) //'Hello JP! How are you doing during the year of 2013?'\n\nS.TMPL_OPEN = '{'\nS.TMPL_CLOSE = '}'\nstr = \"Hello {name}! How are you doing during the year of {date-year}?\"\nconsole.log(S(str).template(values).s) //'Hello JP! How are you doing during the year of 2013?'\n```\n\n\n### - times(n) ###\n\nReturns a string repeated `n` times.\n\nAlias: `repeat()`\n\nExample:\n\n```javascript\nS(' ').times(5).s //'     '\nS('*').times(3).s //'***'\n```\n\n\n### - toBoolean() / toBool()\n\nConverts a a logical truth string to boolean. That is: `true`, `1`, `'true'`, `'on'`, or `'yes'`.\n\nJavaScript Note: You can easily convert truthy values to `booleans` by prefixing them with `!!`. e.g.\n`!!'hi' === true` or `!!'' === false` or `!!{} === true`.\n\nExample:\n\n```javascript\nS('true').toBoolean() //true\nS('false').toBoolean() //false\nS('hello').toBoolean() //false\nS(true).toBoolean() //true\nS('on').toBoolean() //true\nS('yes').toBoolean() //true\nS('TRUE').toBoolean() //true\nS('TrUe').toBoolean() //true\nS('YES').toBoolean() //true\nS('ON').toBoolean() //true\nS('').toBoolean() //false\nS(undefined).toBoolean() //false\nS('undefined').toBoolean() //false\nS(null).toBoolean() //false\nS(false).toBoolean() //false\nS({}).toBoolean() //false\nS(1).toBoolean() //true\nS(-1).toBoolean() //false\nS(0).toBoolean() //false\n```\n\n\n\n### - toCSV(options) ###\n\nConverts an array or object to a CSV line.\n\nYou can either optionally pass in two string arguments or pass in a configuration object.\n\n**String Arguments:**\n- `delimiter`: The character that is separates or delimits fields. Default: `,`\n- `qualifier`: The character that encloses fields. Default: `\"`\n\n\n**Object Configuration:**\n- `delimiter`: The character that is separates or delimits fields. Default: `,`\n- `qualifier`: The character that encloses fields. Default: `\"`\n- `escape`: The character that escapes any incline `qualifier` characters. Default: `\\`, in JS this is `\\\\`\n- `encloseNumbers`: Enclose number objects with the `qualifier` chracter. Default: `true`\n- `keys`: If the input isn't an array, but an object, then if this is set to true, the keys will be output to the CSV line, otherwise it's the object's values. Default: `false`.\n\nExample:\n\n```javascript\nS(['a', 'b', 'c']).toCSV().s //'\"a\",\"b\",\"c\"'\nS(['a', 'b', 'c']).toCSV(':').s //'\"a\":\"b\":\"c\"'\nS(['a', 'b', 'c']).toCSV(':', null).s //'a:b:c')\nS(['a', 'b', 'c']).toCSV('*', \"'\").s //\"'a'*'b'*'c'\"\nS(['a\"', 'b', 4, 'c']).toCSV({delimiter: ',', qualifier: '\"', escape: '\\\\',  encloseNumbers: false}).s //'\"a\\\\\"\",\"b\",4,\"c\"'\nS({firstName: 'JP', lastName: 'Richardson'}).toCSV({keys: true}).s //'\"firstName\",\"lastName\"'\nS({firstName: 'JP', lastName: 'Richardson'}).toCSV().s //'\"JP\",\"Richardson\"'\n```\n\n\n### - toFloat([precision]) ###\n\nReturn the float value, wraps parseFloat.\n\nExample:\n\n```javascript\nS('5').toFloat() // 5\nS('5.3').toFloat()  //5.3\nS(5.3).toFloat()  //5.3\nS('-10').toFloat()  //-10\nS('55.3 adfafaf').toFloat() // 55.3\nS('afff 44').toFloat()  //NaN\nS(3.45522222333232).toFloat(2) // 3.46\n```\n\n\n### - toInt() / toInteger() ###\n\nReturn the number value in integer form. Wrapper for `parseInt()`. Can also parse hex values.\n\nExample:\n\n```javascript\nS('5').toInt(); //5\nS('5.3').toInt(); //5;\nS(5.3).toInt(); //5;\nS('-10').toInt(); //-10\nS('55 adfafaf').toInt(); //55\nS('afff 44').toInt(); //NaN\nS('0xff').toInt() //255\n```\n\n\n\n### - toString() ###\n\nAlias: `s`\n\nReturn the string representation of an `S` object. Not really necessary to use. However, JS engines will look at an object and display its `toString()` result.\n\nExample:\n\n```javascript\nS('my name is JP.').capitalize().toString(); //My name is JP.\nvar a = \"Hello \" + S('joe!'); //a = \"Hello joe!\"\nS(\"Hello\").toString() === S(\"Hello\").s; //true\n```\n\n\n### - trim() ###\n\nReturn the string with leading and trailing whitespace removed. Reverts to native `trim()` if it exists.\n\nExample:\n\n```javascript\nS('hello ').trim().s; //'hello'\nS(' hello ').trim().s; //'hello'\nS('\\nhello').trim().s; //'hello'\nS('\\nhello\\r\\n').trim().s; //'hello'\nS('\\thello\\t').trim().s; //'hello'\n```\n\n\n### - trimLeft() ###\n\nReturn the string with leading and whitespace removed\n\nExample:\n\n```javascript\nS('  How are you?').trimLeft().s; //'How are you?';\n```\n\n\n### - trimRight() ###\n\nReturn the string with trailing whitespace removed.\n\nExample:\n\n```javascript\nS('How are you?   ').trimRight().s; //'How are you?';\n```\n\n\n### - truncate(length, [chars]) ###\n\nTruncates the string, accounting for word placement and character count.\n\nExample:\n\n```javascript\nS('this is some long text').truncate(3).s //'...'\nS('this is some long text').truncate(7).s //'this is...'\nS('this is some long text').truncate(11).s //'this is...'\nS('this is some long text').truncate(12).s //'this is some...'\nS('this is some long text').truncate(11).s //'this is...'\nS('this is some long text').truncate(14, ' read more').s //'this is some read more'\n```\n\n\n\n### - underscore()\n\nReturns converted camel cased string into a string delimited by underscores.\n\nExample:\n\n```javascript\nS('dataRate').underscore().s; //'data_rate'\nS('CarSpeed').underscore().s; //'_car_speed'\nS('yesWeCan').underscore().s; //'yes_we_can'\n```\n\n\n### - unescapeHTML() ###\n\nUnescapes the html.\n\nExample:\n\n```javascript\nS('&lt;div&gt;hi&lt;/div&gt;').unescapeHTML().s; //<div>hi</div>\n```\n\n### - wrapHTML() ###\n\nwrapHTML helps to avoid concatenation of element with string. \nthe string will be wrapped with HTML Element and their attributes.\n\nExample:\n```javascript\nS('Venkat').wrapHTML().s //<span>Venkat</span>\nS('Venkat').wrapHTML('div').s //<div>Venkat</div>\nS('Venkat').wrapHTML('div', {\n    \"class\": \"left bullet\"\n}).s //<div class=\"left bullet\">Venkat</div>\nS('Venkat').wrapHTML('div', {\n    \"id\": \"content\",\n    \"class\": \"left bullet\"\n}).s // <div id=\"content\" class=\"left bullet\">Venkat</div>\n```\n\n### + VERSION ###\n\nReturns native JavaScript string containing the version of `string.js`.\n\nExample:\n\n```javascript\nS.VERSION; //1.0.0\n```\n\n\nQuirks\n------\n\n`decodeHtmlEntities()` converts `&nbsp;` to **0xa0** (160) and not **0x10** (20). Most browsers consider 0xa0 to be whitespace characters, Internet Explorer does not despite it being part of the ECMA standard. Google Closure does a good job of normalizing this behavior. This may need to be fixed in `string.js` at some point in time.\n\n\n\nTesting\n-------\n\n### Node.js\n\nInstall the dev dependencies:\n\n    $ npm install string --development\n\nInstall mocha globally:\n\n    $ npm install -g mocha\n\nThen navigate to the installed directory:\n\n    $ cd node_modules/string/\n\nRun test package:\n\n    $ mocha test\n\n\n\n### Browser ###\n\n[Click here to run the tests in your web browser.][browsertest]\n\n\n\nCredits\n-------\n\nI have looked at the code by the creators in the libraries mentioned in **Motivation**. As noted in the source code, I've specifically used code from Google Closure (Google Inc), Underscore String [Esa-Matti Suuronen](http://esa-matti.suuronen.org/), and php.js (http://phpjs.org/authors/index), [Substack](https://github.com/substack/node-ent) and [TJ Holowaychuk](https://github.com/component/pad).\n\n\n\nContributions\n-------------\n\nIf you contribute to this library, just modify `string.js`, `string.test.js`, and update `README.md`. I'll update the website docs and generate the new `string.min.js`, changelog and version.\n\n\n### Contributors\n\n(You can add your name, or I'll add it if you forget)\n\n- [*] [JP Richardson](https://github.com/jprichardson)\n- [*] [Leonardo Otero](https://github.com/oteroleonardo)\n- [*] [Jordan Scales](https://github.com/prezjordan)\n- [*] [Eduardo de Matos](https://github.com/eduardo-matos)\n- [*] [Christian Maughan Tegnér](https://github.com/CMTegner)\n- [*] [Mario Gutierrez](https://github.com/mgutz)\n- [*] [Sean O'Dell](https://github.com/seanodell)\n- [*] [Tim de Koning](https://github.com/Reggino)\n- [*] [David Volm](https://github.com/daxxog)\n- [*] [Jeff Grann](https://github.com/jeffgrann)\n- [*] [Vlad GURDIGA](https://github.com/gurdiga)\n- [*] [Jon Principe](https://github.com/jprincipe)\n- [*] [James Manning](https://github.com/jamesmanning)\n- [*] [Nathan Friedly](https://github.com/nfriedly)\n- [*] [Alison Rowland](https://github.com/arowla)\n- [1] [Venkatraman.R](https://github.com/ramsunvtech)\n- [1] [r3Fuze](https://github.com/r3Fuze)\n- [3] [Sergio Muriel](https://github.com/Sergio-Muriel)\n- [1] [Matt Hickford](https://github.com/hickford)\n- [1] [Petr Brzek](https://github.com/petrbrzek)\n- [1] [Alex Zinchenko](https://github.com/yumitsu)\n- [1] [Guy Ellis](https://github.com/guyellis)\n \n\nRoadmap to v2.0\n---------------\n- break up this module into smaller logically grouped modules. The Node.js version would probably always include most of the functions. https://github.com/jprichardson/string.js/issues/10\n- allow a more functional style similar to Underscore and lowdash. This may introduce a `chain` function though. https://github.com/jprichardson/string.js/issues/49\n- language specific plugins i.e. https://github.com/jprichardson/string.js/pull/46\n- move this repo over to https://github.com/stringjs\n\n\n\nLicense\n-------\n\nLicensed under MIT.\n\nCopyright (C) 2012-2014 JP Richardson <jprichardson@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n[testfile]: https://github.com/jprichardson/string.js/blob/master/test/string.test.js\n[browsertest]: http://stringjs.com/browser.test.html\n\n[aboutjp]: http://about.me/jprichardson\n[twitter]: http://twitter.com/jprichardson\n[procbits]: http://procbits.com\n\n\n\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jprichardson/string.js/issues"
  },
  "_id": "string@2.1.0",
  "_from": "string@"
}
