escape-string-applescript

Escape a string for use in AppleScript

MIT 5 个版本
安装
npm install escape-string-applescript
yarn add escape-string-applescript
pnpm add escape-string-applescript
bun add escape-string-applescript
README

escape-string-applescript

Escape a string for use in AppleScript

According to the AppleScript docs, \ and " have special meaning and should be escaped.

Install

$ npm install escape-string-applescript

Usage

import {execFile} from 'child_process';
import escapeStringAppleScript from 'escape-string-applescript';

const string = escapeStringAppleScript('"i like unicorns"');
//=> '\"i like unicorns\"'

const script = `set unicornMessage to "${string}"`;

execFile('osascript', ['-e', script]);
版本列表
3.0.0 2021-04-15
2.0.0 2017-01-13
1.0.0 2014-08-06
0.1.1 2014-05-16
0.1.0 2014-05-14