figma-api-stub
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -356,2 +356,38 @@ "use strict"; | ||
}; | ||
TextNodeStub.prototype.deleteCharacters = function (start, end) { | ||
if (joinedConfig.simulateErrors && !isFontLoaded(this.fontName)) { | ||
throw new Error("Error: font is not loaded " + this.fontName.family + " " + this.fontName.style); | ||
} | ||
if (joinedConfig.simulateErrors && start < 0) { | ||
throw new Error("Error: Expected \"start\" to have value >=0"); | ||
} | ||
if (joinedConfig.simulateErrors && end < 0) { | ||
throw new Error("Error: Expected \"end\" to have value >=0"); | ||
} | ||
if (joinedConfig.simulateErrors && end > this._characters.length) { | ||
throw new Error("Error: Cannot delete characters at index greater than the length of the text"); | ||
} | ||
this._characters = | ||
this._characters.slice(start, end) + | ||
(end === this._characters.length | ||
? "" | ||
: this._characters.slice(end + 1)); | ||
}; | ||
TextNodeStub.prototype.insertCharacters = function (start, characters, _useStyle) { | ||
if (_useStyle === void 0) { _useStyle = "BEFORE"; } | ||
if (joinedConfig.simulateErrors && !isFontLoaded(this.fontName)) { | ||
throw new Error("Error: font is not loaded " + this.fontName.family + " " + this.fontName.style); | ||
} | ||
if (joinedConfig.simulateErrors && start < 0) { | ||
throw new Error("Error: Expected \"start\" to have value >=0"); | ||
} | ||
if (joinedConfig.simulateErrors && start > this._characters.length) { | ||
throw new Error("Error: Cannot insert characters at index greater than the length of the text"); | ||
} | ||
this._characters = [ | ||
this._characters.slice(0, start), | ||
characters, | ||
this._characters.slice(start) | ||
].join(""); | ||
}; | ||
return TextNodeStub; | ||
@@ -358,0 +394,0 @@ }()); |
{ | ||
"name": "figma-api-stub", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"description": "Figma API stub", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
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
58788
952