// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.IO; using Microsoft.Framework.Internal; namespace Microsoft.Framework.WebEncoders { /// /// Provides services for JavaScript-escaping strings. /// public interface IJavaScriptStringEncoder { /// /// JavaScript-escapes a character array and writes the result to the /// supplied output. /// /// /// The encoded value is appropriately encoded for inclusion inside a quoted JSON string. /// void JavaScriptStringEncode([NotNull] char[] value, int startIndex, int charCount, [NotNull] TextWriter output); /// /// JavaScript-escapes a given input string. /// /// /// The JavaScript-escaped value, or null if the input string was null. /// The encoded value is appropriately encoded for inclusion inside a quoted JSON string. /// string JavaScriptStringEncode(string value); /// /// JavaScript-escapes a given input string and writes the /// result to the supplied output. /// /// /// The encoded value is appropriately encoded for inclusion inside a quoted JSON string. /// void JavaScriptStringEncode([NotNull] string value, int startIndex, int charCount, [NotNull] TextWriter output); } }