Socket
Socket
Sign inDemoInstall

@microsoft/kiota-serialization-text

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/kiota-serialization-text - npm Package Compare versions

Comparing version 1.0.0-preview.9 to 1.0.0-preview.10

4

dist/cjs/src/textParseNode.d.ts

@@ -12,4 +12,4 @@ import { DateOnly, Duration, Parsable, ParsableFactory, ParseNode, TimeOnly } from "@microsoft/kiota-abstractions";

getStringValue: () => string;
getChildNode: (identifier: string) => ParseNode;
getBooleanValue: () => boolean;
getChildNode: (identifier: string) => ParseNode | undefined;
getBooleanValue: () => boolean | undefined;
getNumberValue: () => number;

@@ -16,0 +16,0 @@ getGuidValue: () => string;

@@ -16,3 +16,13 @@ "use strict";

};
this.getBooleanValue = () => (this.text && this.text.toLowerCase() === "true") || this.text === "1";
this.getBooleanValue = () => {
var _a;
const value = (_a = this.getStringValue()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
if (value === "true" || value === "1") {
return true;
}
else if (value === "false" || value === "0") {
return false;
}
return undefined;
};
this.getNumberValue = () => Number(this.text);

@@ -43,9 +53,8 @@ this.getGuidValue = () => this.text;

};
this.text =
this.text &&
this.text.length > 1 &&
this.text.charAt(0) === '"' &&
this.text.charAt(this.text.length - 1) === '"'
? this.text.substring(1, this.text.length - 2)
: this.text;
if (this.text &&
this.text.length > 1 &&
this.text.charAt(0) === '"' &&
this.text.charAt(this.text.length - 1) === '"') {
this.text = this.text.substring(1, this.text.length - 2);
}
}

@@ -52,0 +61,0 @@ }

@@ -21,3 +21,3 @@ "use strict";

this.writeBooleanValue = (key, value) => {
if (value) {
if (value !== null && value !== undefined) {
this.writeStringValue(key, `${value}`);

@@ -24,0 +24,0 @@ }

@@ -12,4 +12,4 @@ import { DateOnly, Duration, Parsable, ParsableFactory, ParseNode, TimeOnly } from "@microsoft/kiota-abstractions";

getStringValue: () => string;
getChildNode: (identifier: string) => ParseNode;
getBooleanValue: () => boolean;
getChildNode: (identifier: string) => ParseNode | undefined;
getBooleanValue: () => boolean | undefined;
getNumberValue: () => number;

@@ -16,0 +16,0 @@ getGuidValue: () => string;

@@ -13,3 +13,13 @@ import { DateOnly, Duration, TimeOnly, toFirstCharacterUpper, } from "@microsoft/kiota-abstractions";

};
this.getBooleanValue = () => (this.text && this.text.toLowerCase() === "true") || this.text === "1";
this.getBooleanValue = () => {
var _a;
const value = (_a = this.getStringValue()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
if (value === "true" || value === "1") {
return true;
}
else if (value === "false" || value === "0") {
return false;
}
return undefined;
};
this.getNumberValue = () => Number(this.text);

@@ -40,11 +50,10 @@ this.getGuidValue = () => this.text;

};
this.text =
this.text &&
this.text.length > 1 &&
this.text.charAt(0) === '"' &&
this.text.charAt(this.text.length - 1) === '"'
? this.text.substring(1, this.text.length - 2)
: this.text;
if (this.text &&
this.text.length > 1 &&
this.text.charAt(0) === '"' &&
this.text.charAt(this.text.length - 1) === '"') {
this.text = this.text.substring(1, this.text.length - 2);
}
}
}
TextParseNode.noStructuredDataMessage = "text does not support structured data";

@@ -18,3 +18,3 @@ export class TextSerializationWriter {

this.writeBooleanValue = (key, value) => {
if (value) {
if (value !== null && value !== undefined) {
this.writeStringValue(key, `${value}`);

@@ -21,0 +21,0 @@ }

{
"name": "@microsoft/kiota-serialization-text",
"version": "1.0.0-preview.9",
"version": "1.0.0-preview.10",
"description": "Implementation of Kiota Serialization interfaces for text",

@@ -46,6 +46,9 @@ "files": [

"dependencies": {
"@microsoft/kiota-abstractions": "^1.0.0-preview.9",
"@microsoft/kiota-abstractions": "^1.0.0-preview.10",
"tslib": "^2.3.1"
},
"gitHead": "526fe938c5ac9516b11db81d279b26b7c84ac5aa"
"publishConfig": {
"access": "public"
},
"gitHead": "bec5afacc59af7b15324f241ed49f85f705110ea"
}

@@ -18,3 +18,3 @@ import {

constructor(private readonly text: string) {
this.text =
if (
this.text &&

@@ -24,17 +24,25 @@ this.text.length > 1 &&

this.text.charAt(this.text.length - 1) === '"'
? this.text.substring(1, this.text.length - 2)
: this.text;
) {
this.text = this.text.substring(1, this.text.length - 2);
}
}
public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined;
public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined;
public getStringValue = (): string => this.text;
public getStringValue = () => this.text;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getChildNode = (identifier: string): ParseNode => {
public getChildNode = (identifier: string): ParseNode | undefined => {
throw new Error(TextParseNode.noStructuredDataMessage);
};
public getBooleanValue = (): boolean =>
(this.text && this.text.toLowerCase() === "true") || this.text === "1";
public getNumberValue = (): number => Number(this.text);
public getGuidValue = (): string => this.text;
public getDateValue = (): Date => new Date(Date.parse(this.text));
public getBooleanValue = (): boolean | undefined => {
const value = this.getStringValue()?.toLowerCase();
if (value === "true" || value === "1") {
return true;
} else if (value === "false" || value === "0") {
return false;
}
return undefined;
};
public getNumberValue = () => Number(this.text);
public getGuidValue = () => this.text;
public getDateValue = () => new Date(Date.parse(this.text));
public getDateOnlyValue = () => DateOnly.parse(this.getStringValue());

@@ -41,0 +49,0 @@ public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue());

@@ -33,3 +33,3 @@ import {

public writeBooleanValue = (key?: string, value?: boolean): void => {
if (value) {
if (value !== null && value !== undefined) {
this.writeStringValue(key, `${value}`);

@@ -36,0 +36,0 @@ }

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

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