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

morpheme-match

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morpheme-match - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

11

lib/morpheme-match.js

@@ -29,3 +29,4 @@ // LICENSE : MIT

var matchTokens = [];
return function (token) {
var matchSkipped = [];
return function (token, index) {
while (currentTokenPosition < tokenCount) {

@@ -35,2 +36,3 @@ var expectedToken = matchedTokens[currentTokenPosition];

matchTokens.push(token);
matchSkipped.push(false);
currentTokenPosition += 1;

@@ -40,5 +42,7 @@ break;

currentTokenPosition += 1;
matchSkipped.push(true);
} else {
// reset position
matchTokens.length = 0;
matchSkipped.length = 0;
currentTokenPosition = 0;

@@ -51,8 +55,11 @@ break;

var tokens = matchTokens.slice();
var skipped = matchSkipped.slice();
// match -> reset
currentTokenPosition = 0;
matchTokens.length = 0;
matchSkipped.length = 0;
return {
match: true,
tokens: tokens
tokens: tokens,
skipped: skipped
};

@@ -59,0 +66,0 @@ }

2

package.json

@@ -18,3 +18,3 @@ {

],
"version": "1.2.0",
"version": "1.2.1",
"main": "lib/morpheme-match.js",

@@ -21,0 +21,0 @@ "directories": {

@@ -23,3 +23,3 @@ # morpheme-match [![Build Status](https://travis-ci.org/azu/morpheme-match.svg?branch=master)](https://travis-ci.org/azu/morpheme-match)

`createTokenMatcher()` return `function(token): { match: boolean, tokens?: Array }`.
`createTokenMatcher()` return `function(token): { match: boolean, tokens?: Array, skipped? Array }`.

@@ -111,3 +111,3 @@ We want to check "名詞かもしれない" contain "かも" token.

const result = tokens.some(token => {
const {match, tokens} = expectToken(token);
const {match, tokens, skipped} = expectToken(token);
resultTokens = tokens;

@@ -114,0 +114,0 @@ return match;

@@ -28,3 +28,4 @@ // LICENSE : MIT

const matchTokens = [];
return (token) => {
const matchSkipped = [];
return (token, index) => {
while (currentTokenPosition < tokenCount) {

@@ -34,2 +35,3 @@ const expectedToken = matchedTokens[currentTokenPosition];

matchTokens.push(token);
matchSkipped.push(false);
currentTokenPosition += 1;

@@ -39,5 +41,7 @@ break;

currentTokenPosition += 1;
matchSkipped.push(true);
} else {
// reset position
matchTokens.length = 0;
matchSkipped.length = 0;
currentTokenPosition = 0;

@@ -50,8 +54,11 @@ break;

const tokens = matchTokens.slice();
const skipped = matchSkipped.slice();
// match -> reset
currentTokenPosition = 0;
matchTokens.length = 0;
matchSkipped.length = 0;
return {
match: true,
tokens: tokens
tokens: tokens,
skipped: skipped,
};

@@ -58,0 +65,0 @@ }

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