escape-string-applescript

3.0.0 • Public • Published

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]);

Related

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    47
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    47
  • 2.0.0
    3,147
  • 1.0.0
    208,369
  • 0.1.1
    2
  • 0.1.0
    2

Package Sidebar

Install

npm i escape-string-applescript

Weekly Downloads

211,567

Version

3.0.0

License

MIT

Unpacked Size

2.85 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus