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

tstate-machine

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tstate-machine - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

.nyc_output/cf253d27106bf4c365778813b0ad60dc.json

9

index.d.ts

@@ -10,12 +10,5 @@ // Generated by dts-bundle v0.7.2

/**
* @description Служебный статический метод, генерирующий текст ошибки, сообщающей о невозможности перейти в состояние
* @param currentState - из какого состояния не смогли перейти
* @param stateName - в какой состяоние не смогли перейти
* @returns string - сообщение об ошибке
*/
static NEXT_STATE_RESTRICTED(currentState: string, stateName: string): string;
/**
* @description Служебный статический декоратор, прячет декорированный метод от перебора в цикле for-in
*/
static hide(): (o: object, key: string, descriptor: PropertyDescriptor) => object;
static hide(_target: object, _key: string, descriptor: PropertyDescriptor): PropertyDescriptor;
/**

@@ -22,0 +15,0 @@ * @description Служебный статичный декоратор, делает наследование состояния.

{
"name": "tstate-machine",
"version": "1.0.6",
"version": "1.1.0",
"description": "TypeScript implementation of StateMachine",

@@ -13,3 +13,3 @@ "types": "index.d.ts",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "node_modules/.bin/mocha -r ts-node/register test/**/*.ts",
"lint-code": "node_modules/.bin/tslint -c ./tslint.json -p ./tsconfig.json --type-check",

@@ -34,10 +34,17 @@ "build": "webpack"

"devDependencies": {
"@types/chai": "^4.0.3",
"@types/mocha": "^2.2.41",
"chai": "4.1.1",
"dts-bundle": "0.7.2",
"lodash": "4.17.4",
"reflect-metadata": "0.1.10",
"mocha": "3.5.0",
"nyc": "11.2.1",
"ts-loader": "2.3.2",
"ts-node": "3.3.0",
"tslint": "5.3.2",
"ts-loader": "2.1.0",
"typescript": "2.3.3",
"typescript": "2.4.1",
"webpack": "2.6.1"
},
"dependencies": {
"reflect-metadata": "0.1.10"
}
}

@@ -1,3 +0,6 @@

# Реализация StateMachine на TypeScript
# tstate-machine
[![Build Status](https://travis-ci.org/SoEasy/tstate-machine.svg?branch=master)](https://travis-ci.org/SoEasy/tstate-machine)
Реализация StateMachine на TypeScript
## Attention

@@ -4,0 +7,0 @@ Модуль работоспособен, но разработка еще не закончена. API менять не собираюсь

@@ -1,2 +0,2 @@

import { merge } from 'lodash';
import { merge } from './utils/merge';
import { StateMachineInnerStore } from './StateMachineInnerStore';

@@ -23,3 +23,3 @@ import { StateMachineMetadata } from './StateMachineMetadata';

*/
static NEXT_STATE_RESTRICTED(currentState: string, stateName: string): string {
private static NEXT_STATE_RESTRICTED(currentState: string, stateName: string): string {
return `Navigate to ${stateName} restircted by 'to' argument of state ${currentState}`;

@@ -31,7 +31,5 @@ }

*/
static hide(): (o: object, key: string, descriptor: PropertyDescriptor) => object {
return (_target: object, _key: string, descriptor: PropertyDescriptor): PropertyDescriptor => {
descriptor.enumerable = false;
return descriptor;
};
static hide(_target: object, _key: string, descriptor: PropertyDescriptor): PropertyDescriptor {
descriptor.enumerable = false;
return descriptor;
}

@@ -52,3 +50,3 @@

*/
@StateMachine.hide()
@StateMachine.hide
private get $store(): StateMachineInnerStore {

@@ -67,3 +65,3 @@ let store: StateMachineInnerStore | undefined = StateMachineWeakMap.get(this);

*/
@StateMachine.hide()
@StateMachine.hide
protected get $next(): Array<string> {

@@ -76,3 +74,3 @@ return [];

*/
@StateMachine.hide()
@StateMachine.hide
private get selfPrototype(): any {

@@ -86,3 +84,3 @@ return Object.getPrototypeOf(this);

*/
@StateMachine.hide()
@StateMachine.hide
private getMetadataByName(stateName: string): StateMachineMetadata {

@@ -98,3 +96,3 @@ return StateMachineMetadata.getByName(this.selfPrototype, stateName);

*/
@StateMachine.hide()
@StateMachine.hide
transitTo(targetState: string, ...args: Array<any>): void {

@@ -163,3 +161,3 @@ // Проверить, что нужное состояние зарегистрировано

*/
@StateMachine.hide()
@StateMachine.hide
protected rememberInitState(): void {

@@ -178,3 +176,3 @@ for (const key in this) {

*/
@StateMachine.hide()
@StateMachine.hide
onEnter(stateName: string, cb: (...args: Array<any>) => void): () => void {

@@ -189,3 +187,3 @@ return this.$store.registerEnterCallback(stateName, cb);

*/
@StateMachine.hide()
@StateMachine.hide
onLeave(stateName: string, cb: () => void): () => void {

@@ -198,3 +196,3 @@ return this.$store.registerLeaveCallback(stateName, cb);

*/
@StateMachine.hide()
@StateMachine.hide
get currentState(): string {

@@ -208,3 +206,3 @@ return this.$store.currentState;

*/
@StateMachine.hide()
@StateMachine.hide
is(stateName: string): boolean {

@@ -219,3 +217,3 @@ return this.currentState === stateName;

*/
@StateMachine.hide()
@StateMachine.hide
can(stateName: string): boolean {

@@ -233,3 +231,3 @@ if (this.$store.isInitialState) {

*/
@StateMachine.hide()
@StateMachine.hide
transitions(): Array<string> {

@@ -236,0 +234,0 @@ return this.$store.isInitialState ? this.$next : this.getMetadataByName(this.currentState).to;

@@ -1,2 +0,2 @@

import { merge } from 'lodash';
import { merge } from './utils/merge';

@@ -44,2 +44,3 @@ /**

merge(this.$initialState, assignable);
// Object.assign(this.$initialState, assignable); // Here initial state become as mutable! We have test for it
}

@@ -46,0 +47,0 @@

const StateMachineMetadataKey = 'Tochka_StateMachineMetadata';
import 'reflect-metadata';

@@ -4,0 +3,0 @@ /**

@@ -23,4 +23,4 @@ {

"files": [
"src/StateMachine.ts"
"src/index.ts"
]
}

Sorry, the diff of this file is too big to display

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