Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/cli.ts>quote

A JavaScript extension package for building strong and modern applications.
Latest
function quote
Re-export
import { quote } from "https://deno.land/x/ayonli_jsext@v0.9.72/cli.ts";

Quotes a string to be used as a single argument to a shell command.

Examples

Example 1

import { quote } from "@ayonli/jsext/cli";

console.log(quote("Hello, World!")); // "Hello, World!"
console.log(quote("Hello, 'World'!")); // "Hello, 'World'!"
console.log(quote("Hello, \"World\"!")); // "Hello, \"World\"!"
console.log(quote("Hello, $World!")); // "Hello, \$World!"
console.log(quote("Hello, `World`!")); // "Hello, \`World\`!"
console.log(quote("Hello, \\World!")); // "Hello, \\World!"

Parameters

arg: string

Returns

string