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

x/ayonli_jsext/cli/common.ts>quote

A JavaScript extension package for building strong and modern applications.
Latest
function quote
import { quote } from "https://deno.land/x/ayonli_jsext@v0.9.72/cli/common.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