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

@kizahasi/ot-string

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kizahasi/ot-string - npm Package Compare versions

Comparing version 0.2.4 to 0.3.0

18

dist/types/index.d.ts

@@ -67,7 +67,9 @@ import { Result } from '@kizahasi/result';

declare const secondTooLong = "secondTooLong";
export declare type ComposeAndTransformError = {
type: typeof secondTooShort;
} | {
type: typeof secondTooLong;
declare type ComposeAndTransformErrorBase = {
type: typeof secondTooShort | typeof secondTooLong;
};
export declare type ComposeAndTransformError<TInsert, TDelete> = ComposeAndTransformErrorBase & {
first: TextOperation<TInsert, TDelete>;
second: TextOperation<TInsert, TDelete>;
};
export declare namespace TextTwoWayOperation {

@@ -95,3 +97,3 @@ type Operation = TextOperation<NonEmptyString, NonEmptyString>;

secondPrime: Operation;
}, ComposeAndTransformError>;
}, ComposeAndTransformError<NonEmptyString, NonEmptyString>>;
const toUnit: (source: Operation) => OperationUnit[];

@@ -128,3 +130,3 @@ const ofUnit: (source: ReadonlyArray<OperationUnit>) => Operation;

second: Operation;
}) => Result<Operation, ComposeAndTransformError>;
}) => Result<Operation, ComposeAndTransformError<NonEmptyString, PositiveInt>>;
const transform: ({ first, second, }: {

@@ -136,3 +138,3 @@ first: Operation;

secondPrime: Operation;
}, ComposeAndTransformError>;
}, ComposeAndTransformError<NonEmptyString, PositiveInt>>;
const invert: (source: Operation) => TextOperation<PositiveInt, NonEmptyString>;

@@ -168,3 +170,3 @@ const toUnit: (source: Operation) => OperationUnit[];

second: Operation;
}) => Result<Operation, ComposeAndTransformError>;
}) => Result<Operation, ComposeAndTransformError<PositiveInt, NonEmptyString>>;
const invert: (source: Operation) => TextOperation<NonEmptyString, PositiveInt>;

@@ -171,0 +173,0 @@ const toUnit: (source: Operation) => OperationUnit[];

{
"version": "0.2.4",
"version": "0.3.0",
"license": "MIT",

@@ -14,7 +14,8 @@ "main": "dist/cjs/index.js",

"scripts": {
"build": "yarn lint && yarn prettier && rimraf ./dist && tsc -p tsconfig.build-cjs.json && tsc -p tsconfig.build-esm.json && tsc -p tsconfig.build-types.json",
"build": "rimraf ./dist && tsc -p tsconfig.build-cjs.json && tsc -p tsconfig.build-esm.json && tsc -p tsconfig.build-types.json",
"test": "jest",
"prepare": "yarn build && husky install",
"prepare": "husky install",
"lint": "eslint src test",
"prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \".github/**/*.yml\""
"prettier": "yarn prettier:base --write",
"prettier:base": "prettier \"**/*.{ts,js,json,yml,md}\""
},

@@ -27,3 +28,2 @@ "prettier": {

"tabWidth": 4,
"endOfLine": "crlf",
"arrowParens": "avoid"

@@ -44,15 +44,17 @@ },

"devDependencies": {
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@types/diff-match-patch": "1.0.32",
"@types/jest": "27.0.1",
"@typescript-eslint/eslint-plugin": "4.29.1",
"@typescript-eslint/parser": "4.29.1",
"eslint": "7.32.0",
"@types/jest": "27.0.2",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"eslint": "8.1.0",
"eslint-config-prettier": "8.3.0",
"fast-check": "2.17.0",
"husky": "7.0.1",
"jest": "27.0.6",
"prettier": "2.3.2",
"fast-check": "2.19.0",
"husky": "7.0.4",
"jest": "27.3.1",
"prettier": "2.4.1",
"rimraf": "3.0.2",
"ts-jest": "27.0.4",
"typescript": "4.3.5"
"ts-jest": "27.0.7",
"typescript": "4.4.4"
},

@@ -59,0 +61,0 @@ "dependencies": {

# @kizahasi/ot-string
![GitHub](https://img.shields.io/github/license/kizahasi/ot-string) [![npm version](https://img.shields.io/npm/v/@kizahasi/ot-string.svg?style=flat)](https://www.npmjs.com/package/@kizahasi/ot-string) ![minified size](https://img.shields.io/bundlephobia/min/@kizahasi/ot-string) [![CI](https://github.com/kizahasi/ot-string/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/kizahasi/ot-string/actions/workflows/main.yml) [![publish](https://github.com/kizahasi/ot-string/actions/workflows/publish.yml/badge.svg?branch=release)](https://github.com/kizahasi/ot-string/actions/workflows/publish.yml)
![GitHub](https://img.shields.io/github/license/kizahasi/ot-string) [![npm version](https://img.shields.io/npm/v/@kizahasi/ot-string.svg?style=flat)](https://www.npmjs.com/package/@kizahasi/ot-string) ![minified size](https://img.shields.io/bundlephobia/min/@kizahasi/ot-string) [![CI](https://github.com/kizahasi/ot-string/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/kizahasi/ot-string/actions/workflows/ci.yml) [![publish](https://github.com/kizahasi/ot-string/actions/workflows/publish.yml/badge.svg?branch=release)](https://github.com/kizahasi/ot-string/actions/workflows/publish.yml)

@@ -17,12 +17,8 @@ Operational Transfomation library for string.

// Gets diff of two string (diff-match-patch is used)
const twoWayOperation: TextTwoWayOperation.Operation = TextTwoWayOperation.diff(
{
first: 'Roses are red',
second: 'Violets are blue',
}
);
const twoWayOperation: TextTwoWayOperation.Operation = TextTwoWayOperation.diff({
first: 'Roses are red',
second: 'Violets are blue',
});
const upOperation: TextUpOperation.Operation = TextTwoWayOperation.toUpOperation(
twoWayOperation
);
const upOperation: TextUpOperation.Operation = TextTwoWayOperation.toUpOperation(twoWayOperation);
const second = TextUpOperation.apply({

@@ -36,5 +32,4 @@ prevState: 'Roses are red',

const downOperation: TextDownOperation.Operation = TextTwoWayOperation.toDownOperation(
twoWayOperation
);
const downOperation: TextDownOperation.Operation =
TextTwoWayOperation.toDownOperation(twoWayOperation);
const first = TextDownOperation.applyBack({

@@ -94,3 +89,3 @@ nextState: 'Violets are blue',

- Because this library uses Typescipt namespace, tree-shaking may not work well to reduce the code size.
- Some functions are not implemented (e.g. TextUpOperation.diff).
- Because this library uses Typescipt namespace, tree-shaking may not work well to reduce the code size.
- Some functions are not implemented (e.g. TextUpOperation.diff).

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

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