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

strscanner

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strscanner

lexical string analysis for javascript

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Example


var strscan = require("strscan");

var scanner = strscan("hello world -> ", {
	skipWhitespace: true
});


while(!scanner.eof()) {
	
	scanner.nextChar();

	if(scanner.isAZ()) {
		var word = scanner.nextWord();
	} else 
	if(scanner.cchar() == "-") {
		var arrow = scanner.to(1);
	}
}

API

.eof()

returns true if the scanner is at the end

.nextChar()

scans to the next character

.cchar()

returns the current char

.isAZ()

returns true if the current char is A-Z

.is09()

returns true if the current char is 0-9

.isAlpha()

returns true if the current char is A-Z 0-9

.next(match)

returns true if the current char matches the given regular expression

.nextWord()

returns the next word

.to(count)

scans to the given position, and returns the buffer

.peek(count)

returns a buffer from the current position to the given count, then rewinds

.rewind(count)

rewinds N characters

.skip(count)

skips N characters

FAQs

Package last updated on 20 Feb 2014

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