@atjson/core
Advanced tools
Comparing version 0.5.5 to 0.5.12
@@ -15,2 +15,3 @@ import Annotation from './annotation'; | ||
deleteText(annotation: Annotation): void; | ||
objectReplacementSubstitution(annotation: Annotation): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var AtJSON = (function () { | ||
function AtJSON(options) { | ||
const OBJECT_REPLACEMENT = "\uFFFC"; | ||
class AtJSON { | ||
constructor(options) { | ||
if (typeof options === 'string') { | ||
@@ -12,21 +13,20 @@ options = { content: options }; | ||
} | ||
AtJSON.prototype.addAnnotations = function (annotations) { | ||
addAnnotations(annotations) { | ||
this.annotations = this.annotations.concat(annotations); | ||
}; | ||
AtJSON.prototype.removeAnnotation = function (annotation) { | ||
var index = this.annotations.indexOf(annotation); | ||
} | ||
removeAnnotation(annotation) { | ||
let index = this.annotations.indexOf(annotation); | ||
if (index > -1) { | ||
return this.annotations.splice(index, 1)[0]; | ||
} | ||
}; | ||
AtJSON.prototype.insertText = function (position, text, preserveAdjacentBoundaries) { | ||
if (preserveAdjacentBoundaries === void 0) { preserveAdjacentBoundaries = false; } | ||
} | ||
insertText(position, text, preserveAdjacentBoundaries = false) { | ||
if (position < 0 || position > this.content.length) | ||
throw new Error('Invalid position.'); | ||
var length = text.length; | ||
var before = this.content.slice(0, position); | ||
var after = this.content.slice(position); | ||
const length = text.length; | ||
const before = this.content.slice(0, position); | ||
const after = this.content.slice(position); | ||
this.content = before + text + after; | ||
for (var i = this.annotations.length - 1; i >= 0; i--) { | ||
var a = this.annotations[i]; | ||
for (let i = this.annotations.length - 1; i >= 0; i--) { | ||
let a = this.annotations[i]; | ||
if (a.transform) { | ||
@@ -58,15 +58,15 @@ a.transform(a, this.content, position, text.length, preserveAdjacentBoundaries); | ||
} | ||
}; | ||
AtJSON.prototype.deleteText = function (annotation) { | ||
var start = annotation.start; | ||
var end = annotation.end; | ||
var length = end - start; | ||
} | ||
deleteText(annotation) { | ||
const start = annotation.start; | ||
const end = annotation.end; | ||
const length = end - start; | ||
if (!(start >= 0 && end >= 0)) { | ||
throw new Error('Start and end must be numbers.'); | ||
} | ||
var before = this.content.slice(0, start); | ||
var after = this.content.slice(end); | ||
const before = this.content.slice(0, start); | ||
const after = this.content.slice(end); | ||
this.content = before + after; | ||
for (var i = this.annotations.length - 1; i >= 0; i--) { | ||
var a = this.annotations[i]; | ||
for (let i = this.annotations.length - 1; i >= 0; i--) { | ||
let a = this.annotations[i]; | ||
if (a.end < start) | ||
@@ -99,6 +99,27 @@ continue; | ||
} | ||
}; | ||
return AtJSON; | ||
}()); | ||
} | ||
objectReplacementSubstitution(annotation) { | ||
const start = annotation.start; | ||
const end = annotation.end; | ||
const delta = end - start - 1; | ||
const before = this.content.slice(0, start); | ||
const after = this.content.slice(end); | ||
this.content = before + OBJECT_REPLACEMENT + after; | ||
for (let i = this.annotations.length - 1; i >= 0; i--) { | ||
let a = this.annotations[i]; | ||
if (a === annotation) { | ||
a.end = a.start + 1; | ||
} | ||
else { | ||
if (a.start >= end) { | ||
a.start -= delta; | ||
} | ||
if (a.end >= end) { | ||
a.end -= delta; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
exports.default = AtJSON; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXRqc29uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F0anNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0lBTUUsZ0JBQVksT0FBdUY7UUFDakcsRUFBRSxDQUFDLENBQUMsT0FBTyxPQUFPLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQztZQUNoQyxPQUFPLEdBQUcsRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUM7UUFDakMsQ0FBQztRQUNELElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQztRQUMvQixJQUFJLENBQUMsV0FBVyx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BQUksS0FBSyxDQUFDO2dCQUNuQixDQUFDO2dCQUNELEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLElBQUksR0FBRyxDQUFDLENBQUMsQ0FBQztvQkFDakIsQ0FBQyxDQUFDLEdBQUcsSUFBSSxLQUFLLENBQUM7Z0JBQ2pCLENBQUM7WUFDSCxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7Q0FDRjtBQTVMRCx5QkE0TEMifQ== |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var atjson_1 = require("./atjson"); | ||
const atjson_1 = require("./atjson"); | ||
exports.AtJSON = atjson_1.default; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxtQ0FBOEI7QUFDVCxpQkFEZCxnQkFBTSxDQUNjIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxxQ0FBOEI7QUFDVCxpQkFEZCxnQkFBTSxDQUNjIn0= |
@@ -15,2 +15,3 @@ import Annotation from './annotation'; | ||
deleteText(annotation: Annotation): void; | ||
objectReplacementSubstitution(annotation: Annotation): void; | ||
} |
"use strict"; | ||
const OBJECT_REPLACEMENT = "\uFFFC"; | ||
export default class AtJSON { | ||
@@ -96,3 +97,25 @@ constructor(options) { | ||
} | ||
objectReplacementSubstitution(annotation) { | ||
const start = annotation.start; | ||
const end = annotation.end; | ||
const delta = end - start - 1; | ||
const before = this.content.slice(0, start); | ||
const after = this.content.slice(end); | ||
this.content = before + OBJECT_REPLACEMENT + after; | ||
for (let i = this.annotations.length - 1; i >= 0; i--) { | ||
let a = this.annotations[i]; | ||
if (a === annotation) { | ||
a.end = a.start + 1; | ||
} | ||
else { | ||
if (a.start >= end) { | ||
a.start -= delta; | ||
} | ||
if (a.end >= end) { | ||
a.end -= delta; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXRqc29uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F0anNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsTUFBTSxDQUFDLE9BQU87SUFNWixZQUFZLE9BQXVGO1FBQ2pHLEVBQUUsQ0FBQyxDQUFDLE9BQU8sT0FBTyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUM7WUFDaEMsT0FBTyxHQUFHLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxDQUFDO1FBQ2pDLENBQUM7UUFDRCxJQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUM7UUFDL0IsSUFBSSxDQUFDLFdBQVcsR0FBRyxPQUFPLENBQUMsV0FBVyxJQUFJLEVBQWtCLENBQUM7UUFDN0QsSUFBSSxDQUFDLFdBQVcsR0FBRyxPQUFPLENBQUMsV0FBVyxJQUFJLFlBQVksQ0FBQztJQUN6RCxDQUFDO0lBRUQsY0FBYyxDQUFDLFdBQXNDO1FBQ25ELElBQUksQ0FBQyxXQUFXLEdBQUcsSUFBSSxDQUFDLFdBQVcsQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDLENBQUM7SUFDMUQsQ0FBQztJQUVELGdCQUFnQixDQUFDLFVBQXNCO1FBQ3JDLElBQUksS0FBSyxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBQ2pELEVBQUUsQ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Q0FBQyxPQUFPLEdBQUcsTUFBTSxHQUFHLGtCQUFrQixHQUFHLEtBQUssQ0FBQztRQUVuRCxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDO1lBQ3RELElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDNUIsRUFBRSxDQUFDLENBQUMsQ0FBQyxLQUFLLFVBQVUsQ0FBQyxDQUFDLENBQUM7Z0JBQ3JCLENBQUMsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxDQUFDLEtBQUssR0FBRyxDQUFDLENBQUM7WUFDdEIsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLElBQUksR0FBRyxDQUFDLENBQUMsQ0FBQztvQkFDbkIsQ0FBQyxDQUFDLEtBQUssSUFBSSxLQUFLLENBQUM7Z0JBQ25CLENBQUM7Z0JBQ0QsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxDQUFDO29CQUNqQixDQUFDLENBQUMsR0FBRyxJQUFJLEtBQUssQ0FBQztnQkFDakIsQ0FBQztZQUNILENBQUM7UUFDSCxDQUFDO0lBQ0gsQ0FBQztDQUNGIn0= |
{ | ||
"name": "@atjson/core", | ||
"version": "0.5.5", | ||
"version": "0.5.12", | ||
"description": "A brand new TypeScript library.", | ||
@@ -5,0 +5,0 @@ "main": "dist/commonjs/index.js", |
import Annotation from './annotation'; | ||
const OBJECT_REPLACEMENT = "\uFFFC"; | ||
export default class AtJSON { | ||
@@ -91,3 +93,2 @@ | ||
deleteText(annotation: Annotation) { | ||
// This should really not just truncate annotations, but rather tombstone | ||
@@ -167,2 +168,28 @@ // the modified annotations as an atjson sub-document inside the annotation | ||
} | ||
/** | ||
Replace parse tokens with object replacement characters. | ||
*/ | ||
objectReplacementSubstitution(annotation: Annotation): void { | ||
const start = annotation.start; | ||
const end = annotation.end; | ||
const delta = end - start - 1; | ||
const before = this.content.slice(0, start); | ||
const after = this.content.slice(end); | ||
this.content = before + OBJECT_REPLACEMENT + after; | ||
for (let i = this.annotations.length - 1; i >= 0; i--) { | ||
let a = this.annotations[i]; | ||
if (a === annotation) { | ||
a.end = a.start + 1; | ||
} else { | ||
if (a.start >= end) { | ||
a.start -= delta; | ||
} | ||
if (a.end >= end) { | ||
a.end -= delta; | ||
} | ||
} | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32419
18
479