Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

escape-string-applescript

2.0.0 • Public • Published

escape-string-applescript Build Status

Escape a string for use in AppleScript

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

Install

$ npm install --save escape-string-applescript

Usage

const {execFile} = require('child_process');
const escapeString = require('escape-string-applescript');
 
const str = escapeString('"i like unicorns"');
//=> '\"i like unicorns\"'
 
const script = `set unicornMessage to "${str}"`;
 
execFile('osascript', ['-e', script]);

Related

License

MIT © Sindre Sorhus

install

npm i escape-string-applescript

Downloadsweekly downloads

8,802

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability