escape-string-applescript
Escape a string for use in AppleScript
Last updated 5 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install escape-string-applescript 
SYNC missed versions from official npm registry.

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

Current Tags

  • 3.0.0                                ...           latest (5 years ago)

5 Versions

  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 6
Last Day 1
Last Week 5
Last Month 1
Dependencies (0)
None
Dev Dependencies (2)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |