@microsoft/kiota-serialization-text
Advanced tools
Comparing version 1.0.0-preview.2 to 1.0.0-preview.3
@@ -5,3 +5,4 @@ import { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; | ||
getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode; | ||
private convertArrayBufferToText; | ||
} | ||
//# sourceMappingURL=textParseNodeFactory.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TextParseNodeFactory = void 0; | ||
const util_1 = require("util"); | ||
const textParseNode_1 = require("./textParseNode"); | ||
@@ -20,7 +19,9 @@ class TextParseNodeFactory { | ||
} | ||
const decoder = new util_1.TextDecoder(); | ||
const contentAsStr = decoder.decode(content); | ||
return new textParseNode_1.TextParseNode(contentAsStr); | ||
return new textParseNode_1.TextParseNode(this.convertArrayBufferToText(content)); | ||
} | ||
convertArrayBufferToText(arrayBuffer) { | ||
const uint8Array = new Uint8Array(arrayBuffer); | ||
return String.fromCharCode.apply(null, [...uint8Array]); | ||
} | ||
} | ||
exports.TextParseNodeFactory = TextParseNodeFactory; |
@@ -5,7 +5,7 @@ "use strict"; | ||
const textParseNode_1 = require("../../src/textParseNode"); | ||
describe("jsonParseNodeFactory", () => { | ||
it("jsonParseNodeFactory", async () => { | ||
const jsonParseNodeFactory = new textParseNode_1.TextParseNode("Test"); | ||
chai_1.assert.isDefined(jsonParseNodeFactory); | ||
describe("textParseNode", () => { | ||
it("textParseNode", async () => { | ||
const textParseNode = new textParseNode_1.TextParseNode("Test"); | ||
chai_1.assert.isDefined(textParseNode); | ||
}); | ||
}); |
@@ -5,3 +5,4 @@ import { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; | ||
getRootParseNode(contentType: string, content: ArrayBuffer): ParseNode; | ||
private convertArrayBufferToText; | ||
} | ||
//# sourceMappingURL=textParseNodeFactory.d.ts.map |
@@ -1,2 +0,1 @@ | ||
import { TextDecoder } from "util"; | ||
import { TextParseNode } from "./textParseNode"; | ||
@@ -17,6 +16,8 @@ export class TextParseNodeFactory { | ||
} | ||
const decoder = new TextDecoder(); | ||
const contentAsStr = decoder.decode(content); | ||
return new TextParseNode(contentAsStr); | ||
return new TextParseNode(this.convertArrayBufferToText(content)); | ||
} | ||
convertArrayBufferToText(arrayBuffer) { | ||
const uint8Array = new Uint8Array(arrayBuffer); | ||
return String.fromCharCode.apply(null, [...uint8Array]); | ||
} | ||
} |
import { assert } from "chai"; | ||
import { TextParseNode } from "../../src/textParseNode"; | ||
describe("jsonParseNodeFactory", () => { | ||
it("jsonParseNodeFactory", async () => { | ||
const jsonParseNodeFactory = new TextParseNode("Test"); | ||
assert.isDefined(jsonParseNodeFactory); | ||
describe("textParseNode", () => { | ||
it("textParseNode", async () => { | ||
const textParseNode = new TextParseNode("Test"); | ||
assert.isDefined(textParseNode); | ||
}); | ||
}); |
{ | ||
"name": "@microsoft/kiota-serialization-text", | ||
"version": "1.0.0-preview.2", | ||
"version": "1.0.0-preview.3", | ||
"description": "Implementation of Kiota Serialization interfaces for text", | ||
@@ -46,3 +46,3 @@ "files": [ | ||
}, | ||
"gitHead": "1d8fc8531793c508c897700572ceaa6e0561cf25" | ||
"gitHead": "79aeb602a3976ec2cba47de7d9df970410a19b4c" | ||
} |
import { ParseNode, ParseNodeFactory } from "@microsoft/kiota-abstractions"; | ||
import { TextDecoder } from "util"; | ||
@@ -22,6 +21,9 @@ import { TextParseNode } from "./textParseNode"; | ||
} | ||
const decoder = new TextDecoder(); | ||
const contentAsStr = decoder.decode(content); | ||
return new TextParseNode(contentAsStr); | ||
return new TextParseNode(this.convertArrayBufferToText(content)); | ||
} | ||
private convertArrayBufferToText(arrayBuffer: ArrayBuffer) { | ||
const uint8Array = new Uint8Array(arrayBuffer); | ||
return String.fromCharCode.apply(null, [...uint8Array]); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
502046
59
12122
0