-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
...for the issue: npm/cli#1287
- Loading branch information
Showing
13 changed files
with
792 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/.coverage | ||
/coverage | ||
/dist | ||
/node_modules | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
interface AttributeMap { | ||
[key: string]: any; | ||
} | ||
declare namespace AttributeMap { | ||
function compose(a: AttributeMap | undefined, b: AttributeMap | undefined, keepNull: boolean): AttributeMap | undefined; | ||
function diff(a?: AttributeMap, b?: AttributeMap): AttributeMap | undefined; | ||
function invert(attr?: AttributeMap, base?: AttributeMap): AttributeMap; | ||
function transform(a: AttributeMap | undefined, b: AttributeMap | undefined, priority?: boolean): AttributeMap | undefined; | ||
} | ||
export default AttributeMap; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import diff from 'fast-diff'; | ||
import AttributeMap from './AttributeMap'; | ||
import Op from './Op'; | ||
interface EmbedHandler { | ||
compose<T>(a: T, b: T, keepNull: boolean): T; | ||
invert<T>(a: T, b: T): T; | ||
transform<T>(a: T, b: T, priority: boolean): T; | ||
} | ||
declare class Delta { | ||
static Op: typeof Op; | ||
static AttributeMap: typeof AttributeMap; | ||
private static handlers; | ||
static registerEmbed(embedType: string, handler: EmbedHandler): void; | ||
static unregisterEmbed(embedType: string): void; | ||
private static getHandler; | ||
ops: Op[]; | ||
constructor(ops?: Op[] | { | ||
ops: Op[]; | ||
}); | ||
insert(arg: string | object, attributes?: AttributeMap): this; | ||
delete(length: number): this; | ||
retain(length: number | Record<string, any>, attributes?: AttributeMap): this; | ||
push(newOp: Op): this; | ||
chop(): this; | ||
filter(predicate: (op: Op, index: number) => boolean): Op[]; | ||
forEach(predicate: (op: Op, index: number) => void): void; | ||
map<T>(predicate: (op: Op, index: number) => T): T[]; | ||
partition(predicate: (op: Op) => boolean): [Op[], Op[]]; | ||
reduce<T>(predicate: (accum: T, curr: Op, index: number) => T, initialValue: T): T; | ||
changeLength(): number; | ||
length(): number; | ||
slice(start?: number, end?: number): Delta; | ||
compose(other: Delta): Delta; | ||
concat(other: Delta): Delta; | ||
diff(other: Delta, cursor?: number | diff.CursorInfo): Delta; | ||
eachLine(predicate: (line: Delta, attributes: AttributeMap, index: number) => boolean | void, newline?: string): void; | ||
invert(base: Delta): Delta; | ||
transform(index: number, priority?: boolean): number; | ||
transform(other: Delta, priority?: boolean): Delta; | ||
transformPosition(index: number, priority?: boolean): number; | ||
} | ||
export = Delta; |
Oops, something went wrong.