{
  "_from": "underscore.string@~2.3.1",
  "_id": "underscore.string@2.3.3",
  "_location": "/keybase/argparse/underscore.string",
  "_phantomChildren": {},
  "_requiredBy": [
    "/keybase/argparse"
  ],
  "_shrinkwrap": null,
  "bugs": {
    "url": "https://github.com/epeli/underscore.string/issues"
  },
  "contributors": [
    {
      "name": "Esa-Matti Suuronen",
      "email": "esa-matti@suuronen.org",
      "url": "http://esa-matti.suuronen.org/"
    },
    {
      "name": "Edward Tsech",
      "email": "edtsech@gmail.com"
    },
    {
      "name": "Pavel Pravosud",
      "email": "pavel@pravosud.com",
      "url": "<https://github.com/rwz>"
    },
    {
      "name": "Sasha Koss",
      "email": "kossnocorp@gmail.com",
      "url": "http://koss.nocorp.me/"
    },
    {
      "name": "Vladimir Dronnikov",
      "email": "dronnikov@gmail.com"
    },
    {
      "name": "Pete Kruckenberg",
      "email": "https://github.com/kruckenb",
      "url": "<https://github.com/kruckenb>"
    },
    {
      "name": "Paul Chavard",
      "email": "paul@chavard.net",
      "url": "<http://tchak.net>"
    },
    {
      "name": "Ed Finkler",
      "email": "coj@funkatron.com",
      "url": "<http://funkatron.com>"
    }
  ],
  "dependencies": {},
  "description": "String manipulation extensions for Underscore.js javascript library.",
  "devDependencies": {},
  "directories": {
    "lib": "./lib"
  },
  "engines": {
    "node": "*"
  },
  "homepage": "http://epeli.github.com/underscore.string/",
  "keywords": [
    "string",
    "underscore"
  ],
  "licenses": [
    {
      "type": "MIT"
    }
  ],
  "main": "./lib/underscore.string",
  "name": "underscore.string",
  "optionalDependencies": {},
  "readme": "# Underscore.string [![Build Status](https://secure.travis-ci.org/epeli/underscore.string.png?branch=master)](http://travis-ci.org/epeli/underscore.string) #\n\n\n\nJavascript lacks complete string manipulation operations.\nThis an attempt to fill that gap. List of build-in methods can be found\nfor example from [Dive Into JavaScript][d].\n\n[d]: http://www.diveintojavascript.com/core-javascript-reference/the-string-object\n\n\nAs name states this an extension for [Underscore.js][u], but it can be used\nindependently from **_s**-global variable. But with Underscore.js you can\nuse Object-Oriented style and chaining:\n\n[u]: http://documentcloud.github.com/underscore/\n\n```javascript\n_(\"   epeli  \").chain().trim().capitalize().value()\n=> \"Epeli\"\n```\n\n## Download ##\n\n  * [Development version](https://raw.github.com/epeli/underscore.string/master/lib/underscore.string.js) *Uncompressed with Comments 18kb*\n  * [Production version](https://github.com/epeli/underscore.string/raw/master/dist/underscore.string.min.js) *Minified 7kb*\n\n\n## Node.js installation ##\n\n**npm package**\n\n    npm install underscore.string\n\n**Standalone usage**:\n\n```javascript\nvar _s = require('underscore.string');\n```\n\n**Integrate with Underscore.js**:\n\n```javascript\nvar _  = require('underscore');\n\n// Import Underscore.string to separate object, because there are conflict functions (include, reverse, contains)\n_.str = require('underscore.string');\n\n// Mix in non-conflict functions to Underscore namespace if you want\n_.mixin(_.str.exports());\n\n// All functions, include conflict, will be available through _.str object\n_.str.include('Underscore.string', 'string'); // => true\n```\n\n**Or Integrate with Underscore.js without module loading**\n\nRun the following expression after Underscore.js and Underscore.string are loaded\n```javascript\n// _.str becomes a global variable if no module loading is detected\n// Mix in non-conflict functions to Underscore namespace\n_.mixin(_.str.exports());\n```\n\n## String Functions ##\n\nFor availability of functions in this way you need to mix in Underscore.string functions:\n\n```javascript\n_.mixin(_.string.exports());\n```\n\notherwise functions from examples will be available through _.string or _.str objects:\n\n```javascript\n_.str.capitalize('epeli')\n=> \"Epeli\"\n```\n\n**numberFormat** _.numberFormat(number, [ decimals=0, decimalSeparator='.', orderSeparator=','])\n\nFormats the numbers.\n\n```javascript\n_.numberFormat(1000, 2)\n=> \"1,000.00\"\n\n_.numberFormat(123456789.123, 5, '.', ',')\n=> \"123,456,789.12300\"\n```\n\n\n**levenshtein** _.levenshtein(string1, string2)\n\nCalculates [Levenshtein distance][ld] between two strings.\n[ld]: http://en.wikipedia.org/wiki/Levenshtein_distance\n\n```javascript\n_.levenshtein('kitten', 'kittah')\n=> 2\n```\n\n**capitalize** _.capitalize(string)\n\nConverts first letter of the string to uppercase.\n\n```javascript\n_.capitalize(\"foo Bar\")\n=> \"Foo Bar\"\n```\n\n**chop** _.chop(string, step)\n\n```javascript\n_.chop('whitespace', 3)\n=> ['whi','tes','pac','e']\n```\n\n**clean** _.clean(str)\n\nCompress some whitespaces to one.\n\n```javascript\n_.clean(\" foo    bar   \")\n=> 'foo bar'\n```\n\n**chars** _.chars(str)\n\n```javascript\n_.chars('Hello')\n=> ['H','e','l','l','o']\n```\n\n**swapCase** _.swapCase(str)\n\nReturns a copy of the string in which all the case-based characters have had their case swapped.\n\n```javascript\n_.swapCase('hELLO')\n=> 'Hello'\n```\n\n**include** available only through _.str object, because Underscore has function with the same name.\n\n```javascript\n_.str.include(\"foobar\", \"ob\")\n=> true\n```\n\n(removed) **includes** _.includes(string, substring)\n\nTests if string contains a substring.\n\n```javascript\n_.includes(\"foobar\", \"ob\")\n=> true\n```\n\n**includes** function was removed\n\nBut you can create it in this way, for compatibility with previous versions:\n\n```javascript\n_.includes = _.str.include\n```\n\n**count** _.count(string, substring)\n\n```javascript\n_('Hello world').count('l')\n=> 3\n```\n\n**escapeHTML** _.escapeHTML(string)\n\nConverts HTML special characters to their entity equivalents.\n\n```javascript\n_('<div>Blah blah blah</div>').escapeHTML();\n=> '&lt;div&gt;Blah blah blah&lt;/div&gt;'\n```\n\n**unescapeHTML** _.unescapeHTML(string)\n\nConverts entity characters to HTML equivalents.\n\n```javascript\n_('&lt;div&gt;Blah blah blah&lt;/div&gt;').unescapeHTML();\n=> '<div>Blah blah blah</div>'\n```\n\n**insert** _.insert(string, index, substing)\n\n```javascript\n_('Hello ').insert(6, 'world')\n=> 'Hello world'\n```\n\n**isBlank** _.isBlank(string)\n\n```javascript\n_('').isBlank(); // => true\n_('\\n').isBlank(); // => true\n_(' ').isBlank(); // => true\n_('a').isBlank(); // => false\n```\n\n**join** _.join(separator, *strings)\n\nJoins strings together with given separator\n\n```javascript\n_.join(\" \", \"foo\", \"bar\")\n=> \"foo bar\"\n```\n\n**lines** _.lines(str)\n\n```javascript\n_.lines(\"Hello\\nWorld\")\n=> [\"Hello\", \"World\"]\n```\n\n**reverse** available only through _.str object, because Underscore has function with the same name.\n\nReturn reversed string:\n\n```javascript\n_.str.reverse(\"foobar\")\n=> 'raboof'\n```\n\n**splice**  _.splice(string, index, howmany, substring)\n\nLike a array splice.\n\n```javascript\n_('https://edtsech@bitbucket.org/edtsech/underscore.strings').splice(30, 7, 'epeli')\n=> 'https://edtsech@bitbucket.org/epeli/underscore.strings'\n```\n\n**startsWith** _.startsWith(string, starts)\n\nThis method checks whether string starts with starts.\n\n```javascript\n_(\"image.gif\").startsWith(\"image\")\n=> true\n```\n\n**endsWith** _.endsWith(string, ends)\n\nThis method checks whether string ends with ends.\n\n```javascript\n_(\"image.gif\").endsWith(\"gif\")\n=> true\n```\n\n**succ**  _.succ(str)\n\nReturns the successor to str.\n\n```javascript\n_('a').succ()\n=> 'b'\n\n_('A').succ()\n=> 'B'\n```\n\n**supplant**\n\nSupplant function was removed, use Underscore.js [template function][p].\n\n[p]: http://documentcloud.github.com/underscore/#template\n\n**strip** alias for *trim*\n\n**lstrip** alias for *ltrim*\n\n**rstrip** alias for *rtrim*\n\n**titleize** _.titleize(string)\n\n```javascript\n_('my name is epeli').titleize()\n=> 'My Name Is Epeli'\n```\n\n**camelize** _.camelize(string)\n\nConverts underscored or dasherized string to a camelized one\n\n```javascript\n_('-moz-transform').camelize()\n=> 'MozTransform'\n```\n\n**classify** _.classify(string)\n\nConverts string to camelized class name\n\n```javascript\n_('some_class_name').classify()\n=> 'SomeClassName'\n```\n\n**underscored** _.underscored(string)\n\nConverts a camelized or dasherized string into an underscored one\n\n```javascript\n_('MozTransform').underscored()\n=> 'moz_transform'\n```\n\n**dasherize** _.dasherize(string)\n\nConverts a underscored or camelized string into an dasherized one\n\n```javascript\n_('MozTransform').dasherize()\n=> '-moz-transform'\n```\n\n**humanize** _.humanize(string)\n\nConverts an underscored, camelized, or dasherized string into a humanized one.\nAlso removes beginning and ending whitespace, and removes the postfix '_id'.\n\n```javascript\n_('  capitalize dash-CamelCase_underscore trim  ').humanize()\n=> 'Capitalize dash camel case underscore trim'\n```\n\n**trim** _.trim(string, [characters])\n\ntrims defined characters from begining and ending of the string.\nDefaults to whitespace characters.\n\n```javascript\n_.trim(\"  foobar   \")\n=> \"foobar\"\n\n_.trim(\"_-foobar-_\", \"_-\")\n=> \"foobar\"\n```\n\n\n**ltrim** _.ltrim(string, [characters])\n\nLeft trim. Similar to trim, but only for left side.\n\n\n**rtrim** _.rtrim(string, [characters])\n\nRight trim. Similar to trim, but only for right side.\n\n**truncate** _.truncate(string, length, truncateString)\n\n```javascript\n_('Hello world').truncate(5)\n=> 'Hello...'\n\n_('Hello').truncate(10)\n=> 'Hello'\n```\n\n**prune** _.prune(string, length, pruneString)\n\nElegant version of truncate.\nMakes sure the pruned string does not exceed the original length.\nAvoid half-chopped words when truncating.\n\n```javascript\n_('Hello, world').prune(5)\n=> 'Hello...'\n\n_('Hello, world').prune(8)\n=> 'Hello...'\n\n_('Hello, world').prune(5, ' (read a lot more)')\n=> 'Hello, world' (as adding \"(read a lot more)\" would be longer than the original string)\n\n_('Hello, cruel world').prune(15)\n=> 'Hello, cruel...'\n\n_('Hello').prune(10)\n=> 'Hello'\n```\n\n**words** _.words(str, delimiter=/\\s+/)\n\nSplit string by delimiter (String or RegExp), /\\s+/ by default.\n\n```javascript\n_.words(\"   I   love   you   \")\n=> [\"I\",\"love\",\"you\"]\n\n_.words(\"I_love_you\", \"_\")\n=> [\"I\",\"love\",\"you\"]\n\n_.words(\"I-love-you\", /-/)\n=> [\"I\",\"love\",\"you\"]\n\n_.words(\"   \")\n=> []\n```\n\n**sprintf** _.sprintf(string format, *arguments)\n\nC like string formatting.\nCredits goes to [Alexandru Marasteanu][o].\nFor more detailed documentation, see the [original page][o].\n\n[o]: http://www.diveintojavascript.com/projects/sprintf-for-javascript\n\n```javascript\n_.sprintf(\"%.1f\", 1.17)\n\"1.2\"\n```\n\n**pad** _.pad(str, length, [padStr, type])\n\npads the `str` with characters until the total string length is equal to the passed `length` parameter. By default, pads on the **left** with the space char (`\" \"`). `padStr` is truncated to a single character if necessary.\n\n```javascript\n_.pad(\"1\", 8)\n-> \"       1\";\n\n_.pad(\"1\", 8, '0')\n-> \"00000001\";\n\n_.pad(\"1\", 8, '0', 'right')\n-> \"10000000\";\n\n_.pad(\"1\", 8, '0', 'both')\n-> \"00001000\";\n\n_.pad(\"1\", 8, 'bleepblorp', 'both')\n-> \"bbbb1bbb\";\n```\n\n**lpad** _.lpad(str, length, [padStr])\n\nleft-pad a string. Alias for `pad(str, length, padStr, 'left')`\n\n```javascript\n_.lpad(\"1\", 8, '0')\n-> \"00000001\";\n```\n\n**rpad** _.rpad(str, length, [padStr])\n\nright-pad a string. Alias for `pad(str, length, padStr, 'right')`\n\n```javascript\n_.rpad(\"1\", 8, '0')\n-> \"10000000\";\n```\n\n**lrpad** _.lrpad(str, length, [padStr])\n\nleft/right-pad a string. Alias for `pad(str, length, padStr, 'both')`\n\n```javascript\n_.lrpad(\"1\", 8, '0')\n-> \"00001000\";\n```\n\n**center** alias for **lrpad**\n\n**ljust** alias for *rpad*\n\n**rjust** alias for *lpad*\n\n**toNumber**  _.toNumber(string, [decimals])\n\nParse string to number. Returns NaN if string can't be parsed to number.\n\n```javascript\n_('2.556').toNumber()\n=> 3\n\n_('2.556').toNumber(1)\n=> 2.6\n```\n\n**strRight**  _.strRight(string, pattern)\n\nSearches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found.\n\n```javascript\n_('This_is_a_test_string').strRight('_')\n=> \"is_a_test_string\";\n```\n\n**strRightBack**  _.strRightBack(string, pattern)\n\nSearches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found.\n\n```javascript\n_('This_is_a_test_string').strRightBack('_')\n=> \"string\";\n```\n\n**strLeft**  _.strLeft(string, pattern)\n\nSearches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found.\n\n```javascript\n_('This_is_a_test_string').strLeft('_')\n=> \"This\";\n```\n\n**strLeftBack**  _.strLeftBack(string, pattern)\n\nSearches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found.\n\n```javascript\n_('This_is_a_test_string').strLeftBack('_')\n=> \"This_is_a_test\";\n```\n\n**stripTags**\n\nRemoves all html tags from string.\n\n```javascript\n_('a <a href=\"#\">link</a>').stripTags()\n=> 'a link'\n\n_('a <a href=\"#\">link</a><script>alert(\"hello world!\")</script>').stripTags()\n=> 'a linkalert(\"hello world!\")'\n```\n\n**toSentence**  _.toSentence(array, [delimiter, lastDelimiter])\n\nJoin an array into a human readable sentence.\n\n```javascript\n_.toSentence(['jQuery', 'Mootools', 'Prototype'])\n=> 'jQuery, Mootools and Prototype';\n\n_.toSentence(['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ')\n=> 'jQuery, Mootools unt Prototype';\n```\n\n**toSentenceSerial**  _.toSentenceSerial(array, [delimiter, lastDelimiter])\n\nThe same as `toSentence`, but adjusts delimeters to use [Serial comma](http://en.wikipedia.org/wiki/Serial_comma).\n\n```javascript\n_.toSentenceSerial(['jQuery', 'Mootools'])\n=> 'jQuery and Mootools';\n\n_.toSentenceSerial(['jQuery', 'Mootools', 'Prototype'])\n=> 'jQuery, Mootools, and Prototype'\n\n_.toSentenceSerial(['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ');\n=> 'jQuery, Mootools, unt Prototype';\n```\n\n**repeat** _.repeat(string, count, [separator])\n\nRepeats a string count times.\n\n```javascript\n_.repeat(\"foo\", 3)\n=> 'foofoofoo';\n\n_.repeat(\"foo\", 3, \"bar\")\n=> 'foobarfoobarfoo'\n```\n\n**surround** _.surround(string, wrap)\n\nSurround a string with another string.\n\n```javascript\n_.surround(\"foo\", \"ab\")\n=> 'abfooab';\n```\n\n**quote** _.quote(string, quoteChar) or _.q(string, quoteChar)\n\nQuotes a string. `quoteChar` defaults to `\"`.\n\n```javascript\n_.quote('foo', quoteChar)\n=> '\"foo\"';\n```\n**unquote** _.unquote(string, quoteChar)\n\nUnquotes a string. `quoteChar` defaults to `\"`.\n\n```javascript\n_.unquote('\"foo\"')\n=> 'foo';\n_.unquote(\"'foo'\", \"'\")\n=> 'foo';\n```\n\n\n**slugify** _.slugify(string)\n\nTransform text into a URL slug. Replaces whitespaces, accentuated, and special characters with a dash.\n\n```javascript\n_.slugify(\"Un éléphant à l'orée du bois\")\n=> 'un-elephant-a-loree-du-bois';\n```\n\n***Caution: this function is charset dependent***\n\n**naturalCmp** array.sort(_.naturalCmp)\n\nNaturally sort strings like humans would do.\n\n```javascript\n['foo20', 'foo5'].sort(_.naturalCmp)\n=> [ 'foo5', 'foo20' ]\n```\n\n**toBoolean** _.toBoolean(string) or _.toBool(string)\n\nTurn strings that can be commonly considered as booleas to real booleans. Such as \"true\", \"false\", \"1\" and \"0\". This function is case insensitive.\n\n```javascript\n_.toBoolean(\"true\")\n=> true\n_.toBoolean(\"FALSE\")\n=> false\n_.toBoolean(\"random\")\n=> undefined\n```\n\nIt can be customized by giving arrays of truth and falsy value matcher as parameters. Matchers can be also RegExp objects.\n\n```javascript\n_.toBoolean(\"truthy\", [\"truthy\"], [\"falsy\"])\n=> true\n_.toBoolean(\"true only at start\", [/^true/])\n=> true\n```\n\n## Roadmap ##\n\nAny suggestions or bug reports are welcome. Just email me or more preferably open an issue.\n\n#### Problems\n\nWe lose two things for `include` and `reverse` methods from `_.string`:\n\n* Calls like `_('foobar').include('bar')` aren't available;\n* Chaining isn't available too.\n\nBut if you need this functionality you can create aliases for conflict functions which will be convenient for you:\n\n```javascript\n_.mixin({\n    includeString: _.str.include,\n    reverseString: _.str.reverse\n})\n\n// Now wrapper calls and chaining are available.\n_('foobar').chain().reverseString().includeString('rab').value()\n```\n\n#### Standalone Usage\n\nIf you are using Underscore.string without Underscore. You also have `_.string` namespace for it and `_.str` alias\nBut of course you can just reassign `_` variable with `_.string`\n\n```javascript\n_ = _.string\n```\n\n## Changelog ##\n\n### 2.3.3 ###\n\n* Add `toBoolean`\n* Add `unquote`\n* Add quote char option to `quote`\n* Support dash-separated words in `titleize`\n\n### 2.3.2 ###\n\n* Add `naturalCmp`\n* Bug fix to `camelize`\n* Add ă, ș, ț and ś to `slugify`\n* Doc updates\n* Add support for [component](http://component.io/)\n* [Full changelog](https://github.com/epeli/underscore.string/compare/v2.3.1...v2.3.2)\n\n### 2.3.1 ###\n\n* Bug fixes to `escapeHTML`, `classify`, `substr`\n* Faster `count`\n* Documentation fixes\n* [Full changelog](https://github.com/epeli/underscore.string/compare/v2.3.0...v2.3.1)\n\n### 2.3.0 ###\n\n* Added `numberformat` method\n* Added `levenshtein` method (Levenshtein distance calculation)\n* Added `swapCase` method\n* Changed default behavior of `words` method\n* Added `toSentenceSerial` method\n* Added `surround` and `quote` methods\n\n### 2.2.1 ###\n\n* Same as 2.2.0 (2.2.0rc on npm) to fix some npm drama\n\n### 2.2.0 ###\n\n* Capitalize method behavior changed\n* Various perfomance tweaks\n\n### 2.1.1###\n\n* Fixed words method bug\n* Added classify method\n\n### 2.1.0 ###\n\n* AMD support\n* Added toSentence method\n* Added slugify method\n* Lots of speed optimizations\n\n### 2.0.0 ###\n\n* Added prune, humanize functions\n* Added _.string (_.str) namespace for Underscore.string library\n* Removed includes function\n\nFor upgrading to this version you need to mix in Underscore.string library to Underscore object:\n\n```javascript\n_.mixin(_.string.exports());\n```\n\nand all non-conflict Underscore.string functions will be available through Underscore object.\nAlso function `includes` has been removed, you should replace this function by `_.str.include`\nor create alias `_.includes = _.str.include` and all your code will work fine.\n\n### 1.1.6 ###\n\n* Fixed reverse and truncate\n* Added isBlank, stripTags, inlude(alias for includes)\n* Added uglifier compression\n\n### 1.1.5 ###\n\n* Added strRight, strRightBack, strLeft, strLeftBack\n\n### 1.1.4 ###\n\n* Added pad, lpad, rpad, lrpad methods and aliases center, ljust, rjust\n* Integration with Underscore 1.1.6\n\n### 1.1.3 ###\n\n* Added methods: underscored, camelize, dasherize\n* Support newer version of npm\n\n### 1.1.2 ###\n\n* Created functions: lines, chars, words functions\n\n### 1.0.2 ###\n\n* Created integration test suite with underscore.js 1.1.4 (now it's absolutely compatible)\n* Removed 'reverse' function, because this function override underscore.js 'reverse'\n\n## Contribute ##\n\n* Fork & pull request. Don't forget about tests.\n* If you planning add some feature please create issue before.\n\nOtherwise changes will be rejected.\n\n## Contributors list ##\n[Can be found here](https://github.com/epeli/underscore.string/graphs/contributors).\n\n\n## Licence ##\n\nThe MIT License\n\nCopyright (c) 2011 Esa-Matti Suuronen esa-matti@suuronen.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
  "readmeFilename": "README.markdown",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/epeli/underscore.string.git"
  },
  "version": "2.3.3"
}
