Security update to Drupal 8.4.6
[yaffs-website] / node_modules / underscore.string / README.markdown
1 <span class="github-only">
2
3 The stable release documentation can be found here https://epeli.github.io/underscore.string/
4
5 </span>
6
7 # Underscore.string [![Build Status](https://secure.travis-ci.org/epeli/underscore.string.png?branch=master)](http://travis-ci.org/epeli/underscore.string) #
8
9 Javascript lacks complete string manipulation operations.
10 This is an attempt to fill that gap. List of build-in methods can be found
11 for example from [Dive Into JavaScript][d].
12 Originally started as an Underscore.js extension but is a full standalone
13 library nowadays.
14
15 Upgrading from 2.x to 3.x? Please read the [changelog][c].
16
17 [c]: https://github.com/epeli/underscore.string/blob/master/CHANGELOG.markdown#300
18
19 ## Usage
20
21 ### For Node.js, Browserify and Webpack
22
23 Install from npm
24
25     npm install underscore.string
26
27 Require individual functions
28
29 ```javascript
30 var slugify = require("underscore.string/slugify");
31
32 slugify("Hello world!");
33 // => hello-world
34 ```
35
36 or load the full library to enable chaining
37
38 ```javascript
39 var s = require("underscore.string");
40
41 s("   epeli  ").trim().capitalize().value();
42 // => "Epeli"
43 ```
44
45 but especially when using with [Browserify][] the individual function approach
46 is recommended because using it you only add those functions to your bundle you
47 use.
48
49 [Browserify]: http://browserify.org/
50
51 ### In Meteor
52
53 From your [Meteor][] project folder
54
55 ```shell
56     meteor add underscorestring:underscore.string
57 ```
58
59 and you'll be able to access the library with the ***s*** global from both the server and the client.
60
61 ```javascript
62 s.slugify("Hello world!");
63 // => hello-world
64
65 s("   epeli  ").trim().capitalize().value();
66 // => "Epeli"
67 ```
68
69 [Meteor]: http://www.meteor.com/
70
71 ### Others
72
73 The `dist/underscore.string.js` file is an [UMD][] build. You can load it using
74 an AMD loader such as [RequireJS][] or just stick it to a web page and access
75 the library from the ***s*** global.
76
77 [UMD]: https://github.com/umdjs/umd
78 [RequireJS]: http://requirejs.org/
79
80 ### Underscore.js/Lo-Dash integration
81
82 It is still possible use as Underscore.js/Lo-Dash extension
83
84 ```javascript
85 _.mixin(s.exports());
86 ```
87 But it's not recommended since `include`, `contains`, `reverse` and `join`
88 are dropped because they collide with the functions already defined by Underscore.js.
89
90 ### Lo-Dash-FP/Ramda integration
91
92 If you want to use underscore.string with [ramdajs](http://ramdajs.com/) or [Lo-Dash-FP](https://github.com/lodash/lodash-fp) you can use [underscore.string.fp](https://github.com/stoeffel/underscore.string.fp).
93
94     npm install underscore.string.fp
95
96 ```javascript
97 var S = require('underscore.string.fp');
98 var filter = require('lodash-fp').filter;
99 var filter = require('ramda').filter;
100
101 filter(S.startsWith('.'), [
102   '.vimrc',
103   'foo.md',
104   '.zshrc'
105 ]);
106 // => ['.vimrc', '.zshrc']
107 ```
108
109 ## Download
110
111   * [Development version](https://raw.github.com/epeli/underscore.string/master/dist/underscore.string.js) *Uncompressed with Comments*
112   * [Production version](https://github.com/epeli/underscore.string/raw/master/dist/underscore.string.min.js) *Minified*
113
114 ## API
115
116 ### Individual functions
117
118 #### numberFormat(number, [ decimals=0, decimalSeparator='.', orderSeparator=',']) => string
119
120 Formats the numbers.
121
122 ```javascript
123 numberFormat(1000, 2);
124 // => "1,000.00"
125
126 numberFormat(123456789.123, 5, ".", ",");
127 // => "123,456,789.12300"
128 ```
129
130
131 #### levenshtein(string1, string2) => number
132
133 Calculates [Levenshtein distance][ld] between two strings.
134 [ld]: http://en.wikipedia.org/wiki/Levenshtein_distance
135
136 ```javascript
137 levenshtein("kitten", "kittah");
138 // => 2
139 ```
140
141 #### capitalize(string, [lowercaseRest=false]) => string
142
143 Converts first letter of the string to uppercase. If `true` is passed as second argument the rest
144 of the string will be converted to lower case.
145
146 ```javascript
147 capitalize("foo Bar");
148 // => "Foo Bar"
149
150 capitalize("FOO Bar", true);
151 // => "Foo bar"
152 ```
153
154 #### decapitalize(string) => string
155
156 Converts first letter of the string to lowercase.
157
158 ```javascript
159 decapitalize("Foo Bar");
160 // => "foo Bar"
161 ```
162
163 #### chop(string, step) => array
164
165 ```javascript
166 chop("whitespace", 3);
167 // => ["whi", "tes", "pac", "e"]
168 ```
169
170 #### clean(string) => string
171
172 Trim and replace multiple spaces with a single space.
173
174 ```javascript
175 clean(" foo    bar   ");
176 // => "foo bar"
177 ```
178
179 #### cleanDiacritics(string) => string
180
181 Replace [diacritic][dc] characters with closest ASCII equivalents. Check the
182 [source][s] for supported characters. [Pull requests][p] welcome for missing
183 characters!
184
185 [dc]: https://en.wikipedia.org/wiki/Diacritic
186 [s]: https://github.com/epeli/underscore.string/blob/master/cleanDiacritics.js
187 [p]: https://github.com/epeli/underscore.string/blob/master/CONTRIBUTING.markdown
188
189 ```javascript
190 cleanDiacritics("ääkkönen");
191 // => "aakkonen"
192 ```
193
194 #### chars(string) => array
195
196 ```javascript
197 chars("Hello");
198 // => ["H", "e", "l", "l", "o"]
199 ```
200
201 #### swapCase(string) => string
202
203 Returns a copy of the string in which all the case-based characters have had their case swapped.
204
205 ```javascript
206 swapCase("hELLO");
207 // => "Hello"
208 ```
209
210 #### include(string, substring) => boolean
211
212 Tests if string contains a substring.
213
214 ```javascript
215 include("foobar", "ob");
216 // => true
217 ```
218
219 #### count(string, substring) => number
220
221 Returns number of occurrences of substring in string.
222
223 ```javascript
224 count("Hello world", "l");
225 // => 3
226 ```
227
228 #### escapeHTML(string) => string
229
230 Converts HTML special characters to their entity equivalents.
231 This function supports cent, yen, euro, pound, lt, gt, copy, reg, quote, amp, apos.
232
233 ```javascript
234 escapeHTML("<div>Blah blah blah</div>");
235 // => "&lt;div&gt;Blah blah blah&lt;/div&gt;"
236 ```
237
238 #### unescapeHTML(string) => string
239
240 Converts entity characters to HTML equivalents.
241 This function supports cent, yen, euro, pound, lt, gt, copy, reg, quote, amp, apos, nbsp.
242
243 ```javascript
244 unescapeHTML("&lt;div&gt;Blah&nbsp;blah blah&lt;/div&gt;");
245 // => "<div>Blah blah blah</div>"
246 ```
247
248 #### insert(string, index, substring) => string
249
250 ```javascript
251 insert("Hellworld", 4, "o ");
252 // => "Hello world"
253 ```
254
255 #### replaceAll(string, find, replace, [ignorecase=false]) => string
256
257 ```javascript
258 replaceAll("foo", "o", "a");
259 // => "faa"
260 ```
261
262 #### isBlank(string) => boolean
263
264 ```javascript
265 isBlank(""); // => true
266 isBlank("\n"); // => true
267 isBlank(" "); // => true
268 isBlank("a"); // => false
269 ```
270
271 #### join(separator, ...strings) => string
272
273 Joins strings together with given separator
274
275 ```javascript
276 join(" ", "foo", "bar");
277 // => "foo bar"
278 ```
279
280 #### lines(str) => array
281
282 Split lines to an array
283
284 ```javascript
285 lines("Hello\nWorld");
286 // => ["Hello", "World"]
287 ```
288
289 #### wrap(str, options) => string
290
291 Splits a line `str` (default '') into several lines of size `options.width` (default 75) using a `options.seperator` (default '\n'). If `options.trailingSpaces` is true, make each line at least `width` long using trailing spaces. If `options.cut` is true, create new lines in the middle of words. If `options.preserveSpaces` is true, preserve the space that should be there at the end of a line (only works if options.cut is false).
292
293 ```javascript
294 wrap("Hello World", { width:5 })
295 // => "Hello\nWorld"
296
297 wrap("Hello World", { width:6, seperator:'.', trailingSpaces: true })
298 // => "Hello .World "
299
300 wrap("Hello World", { width:5, seperator:'.', cut:true, trailingSpaces: true })
301 // => "Hello. Worl.d    "
302
303 wrap("Hello World", { width:5, seperator:'.', preserveSpaces: true })
304 // => "Hello .World"
305
306 ```
307
308 #### dedent(str, [pattern]) => string
309
310 Dedent unnecessary indentation or dedent by a pattern.
311
312 Credits go to @sindresorhus.
313 This implementation is similar to https://github.com/sindresorhus/strip-indent
314
315 ```javascript
316 dedent("  Hello\n    World");
317 // => "Hello\n  World"
318
319 dedent("\t\tHello\n\t\t\t\tWorld");
320 // => "Hello\n\t\tWorld"
321
322 dedent("    Hello\n    World", "  "); // Dedent by 2 spaces
323 // => "  Hello\n  World"
324 ```
325
326 #### reverse(string) => string
327
328 Return reversed string:
329
330 ```javascript
331 reverse("foobar");
332 // => "raboof"
333 ```
334
335 #### splice(string, index, howmany, substring) => string
336
337 Like an array splice.
338
339 ```javascript
340 splice("https://edtsech@bitbucket.org/edtsech/underscore.strings", 30, 7, "epeli");
341 // => "https://edtsech@bitbucket.org/epeli/underscore.strings"
342 ```
343
344 #### startsWith(string, starts, [position]) => boolean
345
346 This method checks whether the string begins with `starts` at `position` (default: 0).
347
348 ```javascript
349 startsWith("image.gif", "image");
350 // => true
351
352 startsWith(".vimrc", "vim", 1);
353 // => true
354 ```
355
356 #### endsWith(string, ends, [position]) => boolean
357
358 This method checks whether the string ends with `ends` at `position` (default: string.length).
359
360 ```javascript
361 endsWith("image.gif", "gif");
362 // => true
363
364 endsWith("image.old.gif", "old", 9);
365 // => true
366 ```
367
368 #### pred(string) => string
369
370 Returns the predecessor to str.
371
372 ```javascript
373 pred("b");
374 // => "a"
375
376 pred("B");
377 // => "A"
378 ```
379
380 #### succ(string) => string
381
382 Returns the successor to str.
383
384 ```javascript
385 succ("a");
386 // => "b"
387
388 succ("A");
389 // => "B"
390 ```
391
392
393 #### titleize(string) => string
394
395 ```javascript
396 titleize("my name is epeli");
397 // => "My Name Is Epeli"
398 ```
399
400 #### camelize(string, [decapitalize=false]) => string
401
402 Converts underscored or dasherized string to a camelized one. Begins with
403 a lower case letter unless it starts with an underscore, dash or an upper case letter.
404
405 ```javascript
406 camelize("moz-transform");
407 // => "mozTransform"
408
409 camelize("-moz-transform");
410 // => "MozTransform"
411
412 camelize("_moz_transform");
413 // => "MozTransform"
414
415 camelize("Moz-transform");
416 // => "MozTransform"
417
418 camelize("-moz-transform", true);
419 // => "mozTransform"
420 ```
421
422 #### classify(string) => string
423
424 Converts string to camelized class name. First letter is always upper case
425
426 ```javascript
427 classify("some_class_name");
428 // => "SomeClassName"
429 ```
430
431 #### underscored(string) => string
432
433 Converts a camelized or dasherized string into an underscored one
434
435 ```javascript
436 underscored("MozTransform");
437 // => "moz_transform"
438 ```
439
440 #### dasherize(string) => string
441
442 Converts a underscored or camelized string into an dasherized one
443
444 ```javascript
445 dasherize("MozTransform");
446 // => "-moz-transform"
447 ```
448
449 #### humanize(string) => string
450
451 Converts an underscored, camelized, or dasherized string into a humanized one.
452 Also removes beginning and ending whitespace, and removes the postfix '_id'.
453
454 ```javascript
455 humanize("  capitalize dash-CamelCase_underscore trim  ");
456 // => "Capitalize dash camel case underscore trim"
457 ```
458
459 #### trim(string, [characters]) => string
460
461 Trims defined characters from begining and ending of the string.
462 Defaults to whitespace characters.
463
464 ```javascript
465 trim("  foobar   ");
466 // => "foobar"
467
468 trim("_-foobar-_", "_-");
469 // => "foobar"
470 ```
471
472
473 #### ltrim(string, [characters]) => string
474
475 Left trim. Similar to trim, but only for left side.
476
477 #### rtrim(string, [characters]) => string
478
479 Right trim. Similar to trim, but only for right side.
480
481 #### truncate(string, length, [truncateString = '...']) => string
482
483 ```javascript
484 truncate("Hello world", 5);
485 // => "Hello..."
486
487 truncate("Hello", 10);
488 // => "Hello"
489 ```
490
491 #### prune(string, length, pruneString) => string
492
493 Elegant version of truncate.  Makes sure the pruned string does not exceed the
494 original length.  Avoid half-chopped words when truncating.
495
496 ```javascript
497 prune("Hello, world", 5);
498 // => "Hello..."
499
500 prune("Hello, world", 8);
501 // => "Hello..."
502
503 prune("Hello, world", 5, " (read a lot more)");
504 // => "Hello, world" (as adding "(read a lot more)" would be longer than the original string)
505
506 prune("Hello, cruel world", 15);
507 // => "Hello, cruel..."
508
509 prune("Hello", 10);
510 // => "Hello"
511 ```
512
513 #### words(str, delimiter=/\s+/) => array
514
515 Split string by delimiter (String or RegExp), /\s+/ by default.
516
517 ```javascript
518 words("   I   love   you   ");
519 // => ["I", "love", "you"]
520
521 words("I_love_you", "_");
522 // => ["I", "love", "you"]
523
524 words("I-love-you", /-/);
525 // => ["I", "love", "you"]
526
527 words("   ")
528 // => []
529 ```
530
531 #### sprintf(string format, ...arguments) => string
532
533 C like string formatting.
534 Credits goes to [Alexandru Marasteanu][o].
535 For more detailed documentation, see the [original page][o].
536
537 [o]: http://www.diveintojavascript.com/projects/javascript-sprintf
538
539 ```javascript
540 sprintf("%.1f", 1.17);
541 // => "1.2"
542 ```
543
544 #### pad(str, length, [padStr, type]) => string
545
546 pads 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.
547
548 ```javascript
549 pad("1", 8);
550 // => "       1"
551
552 pad("1", 8, "0");
553 // => "00000001"
554
555 pad("1", 8, "0", "right");
556 // => "10000000"
557
558 pad("1", 8, "0", "both");
559 // => "00001000"
560
561 pad("1", 8, "bleepblorp", "both");
562 // => "bbbb1bbb"
563 ```
564
565 #### lpad(str, length, [padStr]) => string
566
567 left-pad a string. Alias for `pad(str, length, padStr, "left")`
568
569 ```javascript
570 lpad("1", 8, "0");
571 // => "00000001"
572 ```
573
574 #### rpad(str, length, [padStr]) => string
575
576 right-pad a string. Alias for `pad(str, length, padStr, "right")`
577
578 ```javascript
579 rpad("1", 8, "0");
580 // => "10000000"
581 ```
582
583 #### lrpad(str, length, [padStr]) => string
584
585 left/right-pad a string. Alias for `pad(str, length, padStr, "both")`
586
587 ```javascript
588 lrpad("1", 8, '0');
589 // => "00001000"
590 ```
591
592
593 #### toNumber(string, [decimals]) => number
594
595 Parse string to number. Returns NaN if string can't be parsed to number.
596
597 ```javascript
598 toNumber("2.556");
599 // => 3
600
601 toNumber("2.556", 1);
602 // => 2.6
603
604 toNumber("999.999", -1);
605 // => 990
606 ```
607
608 #### strRight(string, pattern) => string
609
610 Searches 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.
611
612 ```javascript
613 strRight("This_is_a_test_string", "_");
614 // => "is_a_test_string"
615 ```
616
617 #### strRightBack(string, pattern) => string
618
619 Searches 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.
620
621 ```javascript
622 strRightBack("This_is_a_test_string", "_");
623 // => "string"
624 ```
625
626 #### strLeft(string, pattern) => string
627
628 Searches 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.
629
630 ```javascript
631 strLeft("This_is_a_test_string", "_");
632 // => "This";
633 ```
634
635 #### strLeftBack(string, pattern) => string
636
637 Searches 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.
638
639 ```javascript
640 strLeftBack("This_is_a_test_string", "_");
641 // => "This_is_a_test";
642 ```
643
644 #### stripTags(string) => string
645
646 Removes all html tags from string.
647
648 ```javascript
649 stripTags("a <a href=\"#\">link</a>");
650 // => "a link"
651
652 stripTags("a <a href=\"#\">link</a><script>alert(\"hello world!\")</script>");
653 // => "a linkalert("hello world!")"
654 ```
655
656 #### toSentence(array, [delimiter, lastDelimiter]) => string
657
658 Join an array into a human readable sentence.
659
660 ```javascript
661 toSentence(["jQuery", "Mootools", "Prototype"]);
662 // => "jQuery, Mootools and Prototype";
663
664 toSentence(["jQuery", "Mootools", "Prototype"], ", ", " unt ");
665 // => "jQuery, Mootools unt Prototype";
666 ```
667
668 #### toSentenceSerial(array, [delimiter, lastDelimiter]) => string
669
670 The same as `toSentence`, but adjusts delimeters to use [Serial comma](http://en.wikipedia.org/wiki/Serial_comma).
671
672 ```javascript
673 toSentenceSerial(["jQuery", "Mootools"]);
674 // => "jQuery and Mootools"
675
676 toSentenceSerial(["jQuery", "Mootools", "Prototype"]);
677 // => "jQuery, Mootools, and Prototype"
678
679 toSentenceSerial(["jQuery", "Mootools", "Prototype"], ", ", " unt ");
680 // => "jQuery, Mootools, unt Prototype"
681 ```
682
683 #### repeat(string, count, [separator]) => string
684
685 Repeats a string count times.
686
687 ```javascript
688 repeat("foo", 3);
689 // => "foofoofoo"
690
691 repeat("foo", 3, "bar");
692 // => "foobarfoobarfoo"
693 ```
694
695 #### surround(string, wrap) => string
696
697 Surround a string with another string.
698
699 ```javascript
700 surround("foo", "ab");
701 // => "abfooab"
702 ```
703
704 #### quote(string, quoteChar) or q(string, quoteChar) => string
705
706 Quotes a string. `quoteChar` defaults to `"`.
707
708 ```javascript
709 quote("foo", '"');
710 // => '"foo"';
711 ```
712 #### unquote(string, quoteChar) => string
713
714 Unquotes a string. `quoteChar` defaults to `"`.
715
716 ```javascript
717 unquote('"foo"');
718 // => "foo"
719
720 unquote("'foo'", "'");
721 // => "foo"
722 ```
723
724
725 #### slugify(string) => string
726
727 Transform text into an ascii slug which can be used in safely in URLs. Replaces whitespaces, accentuated, and special characters with a dash. Limited set of non-ascii characters are transformed to similar versions in the ascii character set such as `ä` to `a`.
728
729 ```javascript
730 slugify("Un éléphant à l\'orée du bois");
731 // => "un-elephant-a-l-oree-du-bois"
732 ```
733
734 ***Caution: this function is charset dependent***
735
736 #### naturalCmp(string1, string2) => number
737
738 Naturally sort strings like humans would do. None numbers are compared by their [ASCII values](http://www.asciitable.com/). Note: this means "a" > "A". Use `.toLowerCase` if this isn't to be desired.
739
740 Just past it to `Array#sort`.
741
742 ```javascript
743 ["foo20", "foo5"].sort(naturalCmp);
744 // => ["foo5", "foo20"]
745 ```
746
747 #### toBoolean(string) => boolean
748
749 Turn strings that can be commonly considered as booleas to real booleans. Such as "true", "false", "1" and "0". This function is case insensitive.
750
751 ```javascript
752 toBoolean("true");
753 // => true
754
755 toBoolean("FALSE");
756 // => false
757
758 toBoolean("random");
759 // => undefined
760 ```
761
762 It can be customized by giving arrays of truth and falsy value matcher as parameters. Matchers can be also RegExp objects.
763
764 ```javascript
765 toBoolean("truthy", ["truthy"], ["falsy"]);
766 // => true
767
768 toBoolean("true only at start", [/^true/]);
769 // => true
770 ```
771
772 #### map(string, function) => string
773
774 Creates a new string with the results of calling a provided function on every character of the given string.
775
776 ```javascript
777 map("Hello world", function(x) {
778   return x;
779 });
780 // => "Hello world"
781
782 map(12345, function(x) {
783   return x;
784 });
785 // => "12345"
786
787 map("Hello world", function(x) {
788   if (x === 'o') x = 'O';
789   return x;
790 });
791 // => "HellO wOrld"
792 ```
793
794 ### Library functions
795
796 If you require the full library you can use chaining and aliases
797
798 #### s(string) => chain
799
800 Start a chain. Returns an immutable chain object with the string functions as
801 methods which return a new chain object instead of the plain string value.
802
803 The chain object includes also following native Javascript string methods:
804
805   - [toUpperCase](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)
806   - [toLowerCase](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)
807   - [split](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)
808   - [replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)
809   - [slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice)
810   - [substring](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/substring)
811   - [substr](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr)
812   - [concat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat)
813
814 #### chain.value()
815
816 Return the string value from the chain
817
818 ```javascript
819 s("  foo  ").trim().capitalize().value();
820 // => "Foo"
821 ```
822
823 When calling a method which does not return a string the resulting value is
824 immediately returned
825
826 ```javascript
827 s(" foobar ").trim().startsWith("foo");
828 // => true
829 ```
830
831 #### chain.tap(function) => chain
832
833 Tap into the chain with a custom function
834
835 ```javascript
836 s("foo").tap(function(value){
837   return value + "bar";
838 }).value();
839 // => "foobar"
840 ```
841
842
843 #### Aliases
844
845 ```javascript
846 strip     = trim
847 lstrip    = ltrim
848 rstrip    = rtrim
849 center    = lrpad
850 rjust     = lpad
851 ljust     = rpad
852 contains  = include
853 q         = quote
854 toBool    = toBoolean
855 camelcase = camelize
856 ```
857
858 ## Maintainers ##
859
860 This library is maintained by
861
862   - Esa-Matti Suuronen – ***[@epeli](https://github.com/epeli)***
863   - Christoph Hermann – ***[@stoeffel](https://github.com/stoeffel)***
864
865 ## Licence ##
866
867 The MIT License
868
869 Copyright (c) 2011 Esa-Matti Suuronen esa-matti@suuronen.org
870
871 Permission is hereby granted, free of charge, to any person obtaining a copy
872 of this software and associated documentation files (the "Software"), to deal
873 in the Software without restriction, including without limitation the rights
874 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
875 copies of the Software, and to permit persons to whom the Software is
876 furnished to do so, subject to the following conditions:
877
878 The above copyright notice and this permission notice shall be included in
879 all copies or substantial portions of the Software.
880
881 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
882 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
883 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
884 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
885 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
886 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
887 THE SOFTWARE.
888
889
890 [d]: http://www.diveintojavascript.com/core-javascript-reference/the-string-object