Socket
Socket
Sign inDemoInstall

moo

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moo - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

24

moo.js

@@ -222,5 +222,4 @@ (function(root, factory) {

}
var pop = g && g.pop
if (pop && typeof pop !== 'boolean') {
throw new Error("pop must be true (in token '" + g.tokenType + "' of state '" + keys[i] + "')")
if (g && g.pop && +g.pop !== 1) {
throw new Error("pop must be 1 (in token '" + g.tokenType + "' of state '" + keys[i] + "')")
}

@@ -357,3 +356,3 @@ }

var group, value
var group, text
if (i === -1) {

@@ -363,6 +362,6 @@ group = this.error

// consume rest of buffer
value = buffer.slice(index)
text = buffer.slice(index)
} else {
value = match[0] // i+1
text = match[0]
group = this.groups[i]

@@ -376,16 +375,15 @@ }

var nl = 1
if (value === '\n') {
if (text === '\n') {
lineBreaks = 1
} else {
while (matchNL.exec(value)) { lineBreaks++; nl = matchNL.lastIndex }
while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex }
}
}
var size = value.length
var token = {
type: (group.getType && group.getType(value)) || group.tokenType,
value: (group.value && group.value(value)) || value,
type: (group.getType && group.getType(text)) || group.tokenType,
value: (group.value && group.value(text)) || text,
text: text,
toString: tokenToString,
offset: index,
size: size,
lineBreaks: lineBreaks,

@@ -395,3 +393,5 @@ line: this.line,

}
// nb. adding more props to token object will make V8 sad!
var size = text.length
this.index += size

@@ -398,0 +398,0 @@ this.line += lineBreaks

{
"name": "moo",
"version": "0.4.0",
"description": "Optimised tokenizer/lexer generator! 🐄 Uses /y for performance. Moo!",
"version": "0.4.1",
"description": "Optimised tokenizer/lexer generator! 🐄 Much performance. Moo!",
"main": "moo.js",

@@ -16,3 +16,3 @@ "files": [

"scripts": {
"test": "jest",
"test": "jest .",
"lint": "eslint moo.js",

@@ -19,0 +19,0 @@ "benchmark": "benchr test/benchmark.js",

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