Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 921 Bytes

README.md

File metadata and controls

19 lines (15 loc) · 921 Bytes

twitter-screen-name Build Status Dependency Status

Extract a twitter screen name from a twitter URL or @username string. Return null if not valid.

Example

var twitterScreenName = require('twitter-screen-name')

twitterScreenName('http://twitter.com/_alanshaw') // -> _alanshaw
twitterScreenName('https://www.twitter.com/_alanshaw') // -> _alanshaw
twitterScreenName('http://twitter.com/_alanshaw/status/695527644901801984') // -> _alanshaw
twitterScreenName('@_alanshaw') // -> _alanshaw
twitterScreenName('_alanshaw') // -> _alanshaw
// etc.

twitterScreenName('http://example.org/foo/') // -> null
twitterScreenName('toolongfortwitter') // -> null
// etc.