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

morpheme-match-all

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

morpheme-match-all - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [2.0.5](https://github.com/azu/morpheme-match-all/compare/v2.0.4...v2.0.5) (2019-10-20)
### Bug Fixes
* **morpheme-match-all:** fix generics type ([283f0fd](https://github.com/azu/morpheme-match-all/commit/283f0fd))
## [2.0.4](https://github.com/azu/morpheme-match-all/compare/v2.0.3...v2.0.4) (2019-10-20)

@@ -8,0 +19,0 @@

6

lib/Expector.d.ts

@@ -7,6 +7,6 @@ import { Token, ExpectedToken, MatchResult } from "morpheme-match";

};
export declare class Expector<T extends ExpectedToken> {
dict: ExpectedDictionary<T>;
export declare class Expector<T extends ExpectedToken, Dictionary extends ExpectedDictionary<T>> {
dict: Dictionary;
private matcher;
constructor(dict: ExpectedDictionary<T>);
constructor(dict: Dictionary);
/**

@@ -13,0 +13,0 @@ * match and return results

import { ExpectedDictionary } from "./Expector";
import { ExpectedToken, Token } from "morpheme-match";
export declare type ExpectedDictionaries<T extends ExpectedToken> = ExpectedDictionary<T>[];
export declare type ExpectedDictionaries<T extends ExpectedToken, Dictionary extends ExpectedDictionary<T>> = Dictionary[];
export { ExpectedDictionary };
export declare type MatchResult<T extends ExpectedToken> = {
export declare type MatchResult<T extends ExpectedToken, Dictionary extends ExpectedDictionary<T>> = {
tokens: Token[];
index: number;
skipped: boolean[];
dict: ExpectedDictionary<T>;
dict: Dictionary & ExpectedDictionary<T>;
};

@@ -14,2 +14,2 @@ /**

*/
export declare function createMatcher<T extends ExpectedToken>(dictionaries: ExpectedDictionaries<T & ExpectedToken>): (actualTokens: Token[]) => MatchResult<T>[];
export declare function createMatcher<T extends Partial<ExpectedToken>, Dictionary extends Partial<ExpectedDictionary<T>>>(dictionaries: ExpectedDictionaries<T & ExpectedToken, Dictionary & ExpectedDictionary<T>>): (tokens: Token[]) => MatchResult<T & ExpectedToken, Dictionary & ExpectedDictionary<T>>[];
{
"name": "morpheme-match-all",
"version": "2.0.4",
"version": "2.0.5",
"description": "A wrapper of morpheme-match API. Match all kuromoji's tokens.",

@@ -52,3 +52,3 @@ "keywords": [

},
"gitHead": "e04dd2b7ba05005a3c8bd8eae81803e0ca77a95f"
"gitHead": "dd31f48045233f08a65adc5d9d774f65615c3874"
}

@@ -12,6 +12,6 @@ // MIT © 2016 azu

export class Expector<T extends ExpectedToken> {
export class Expector<T extends ExpectedToken, Dictionary extends ExpectedDictionary<T>> {
private matcher: any;
constructor(public dict: ExpectedDictionary<T>) {
constructor(public dict: Dictionary) {
assert.ok(Array.isArray(dict["tokens"]), `"tokens" property is required. ${dict}`);

@@ -18,0 +18,0 @@ this.matcher = createTokenMatcher(dict.tokens);

// MIT © 2016 azu
"use strict";
import {ExpectedDictionary, Expector} from "./Expector";
import {ExpectedToken, Token} from "morpheme-match";
import { ExpectedDictionary, Expector } from "./Expector";
import { ExpectedToken, Token } from "morpheme-match";
export type ExpectedDictionaries<T extends ExpectedToken> = ExpectedDictionary<T>[]
export {ExpectedDictionary};
export type MatchResult<T extends ExpectedToken> = {
export type ExpectedDictionaries<T extends ExpectedToken, Dictionary extends ExpectedDictionary<T>> = Dictionary[]
export { ExpectedDictionary };
export type MatchResult<T extends ExpectedToken, Dictionary extends ExpectedDictionary<T>> = {
tokens: Token[];
index: number;
skipped: boolean[];
dict: ExpectedDictionary<T>;
dict: Dictionary & ExpectedDictionary<T>;
};

@@ -18,5 +18,7 @@

*/
export function createMatcher<T extends ExpectedToken>(dictionaries: ExpectedDictionaries<T & ExpectedToken>) {
export function createMatcher<T extends Partial<ExpectedToken>,
Dictionary extends Partial<ExpectedDictionary<T>>>(dictionaries: ExpectedDictionaries<T & ExpectedToken, Dictionary & ExpectedDictionary<T>>)
: (tokens: Token[]) => MatchResult<T & ExpectedToken, Dictionary & ExpectedDictionary<T>>[] {
const expectors = dictionaries.map(dict => {
return new Expector(dict);
return new Expector<T & ExpectedToken, Dictionary & ExpectedDictionary<T>>(dict);
});

@@ -31,3 +33,3 @@ /**

return function morphemeMatchAll(actualTokens: Token[]) {
const matchResults: MatchResult<T>[] = [];
const matchResults: MatchResult<T & ExpectedToken, Dictionary & ExpectedDictionary<T>>[] = [];
actualTokens.forEach(actualToken => {

@@ -34,0 +36,0 @@ expectors.forEach(expector => {

Sorry, the diff of this file is not supported yet

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