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

string contains methods that aren't included in the vanilla JavaScript string. It modifies your String prototype.

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60K
increased by2.81%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 27 Jan 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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