Package Exports
- string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
string.js
This module modifies the String prototype. Yes, it modifies the prototype, get over it.
Installation
npm install string
Make sure that you run the test script to verify that it works on your system.
make test
Usage
Node.js
require('string')
Browsers (IE/Chrome/Safari/Firefox)
<!-- HTML5 -->
<script src="https://raw.github.com/jprichardson/string.js/master/string.min.js"/></script>
<!-- Note that in the mime type for Javascript is now officially 'application/javascript'. If you
set the type to application/javascript in IE browsers, your Javscript will fail. Just don't set a
type via the script tag and set the mime type from your server. Most browsers look at the server mime
type anyway -->
<!-- For HTML4/IE -->
<script type="text/javascript" src="https://raw.github.com/jprichardson/string.js/master/string.min.js"/></script>
Methods
See test file for more details.
includes(needle) or contains(needle) #true if string contains needle
endsWith(suffix) #true if string ends with suffix
startsWith(prefix) #true if string starts with prefix
isAlpha() #true if string is only letters
isDigit() #true if the string only contains digits
isNumber() #true if the string can be converted to a valid Number object
isAlphaDigit() #true if the string only contains letters or numbers
License
(The Apache License)
Some methods as noted, are from Google.
(The MIT License)
Copyright (c) 2012 JP Richardson