Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

lib/string.coffee

6

CHANGELOG.md

@@ -0,1 +1,7 @@

### 0.0.4 / 2012-01-27
* Added trim() method for IE browsers
* Moved string.coffee to lib/string.coffee
* Now included a minified `string.js` named `string.min.js`
* Updated README that now includes Browser usage instructions.
### 0.0.3 / 2012-01-20

@@ -2,0 +8,0 @@ * Cleaned package.json file

2

package.json
{
"name": "string",
"version": "0.0.3",
"version": "0.0.4",
"description": "string contains methods that aren't included in the vanilla JavaScript string. It modifies your String prototype.",

@@ -5,0 +5,0 @@ "homepage": [

@@ -16,4 +16,6 @@ # string.js

## Usage
## Usage
### Node.js
```coffeescript

@@ -23,7 +25,31 @@ require('string')

### Browsers (IE/Chrome/Safari/Firefox)
```html
<!-- 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][1] for more details.
```coffeescript
coming
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
```

@@ -41,4 +67,4 @@

[1]: https://github.com/jprichardson/string.js/blob/master/test/string.test.coffee

@@ -37,2 +37,8 @@ (function() {

if (typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/(^\s*|\s*$)/g, '');
};
}
}).call(this);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc