Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

"SyntaxError: missing : after property id" message in Acrobat Pro DC Javascript Debugger

Community Beginner ,
Jan 16, 2023 Jan 16, 2023

I am trying to run the following code in the JavaScript editor in Adobe Acrobat Pro DC.

const
    getPathes = ({ value = '', sub }) => sub
        ? Object
            .entries(sub)
            .flatMap(([k, v]) => getPathes(v).map(([p, s]) => [k + (p && '.') + p, value + (value && '') + s]))
        : [['', value]],
    input = [["1", "I can "], ["1.1", "speak "], ["1.1.1", "English."], ["1.1.2", "Chinese "], ["1.1.2.1", "well."], ["1.2", "eat noodles."], ["1.3", "play football."], ["2", "I "], ["2.1", "drink."], ["2.2", "sleep."], ["3", "I am the man."], ["4", "Hire me."]],
    tree = input.reduce((t, [path, value]) => {
        path.split('.').reduce((o, k) => (o.sub ??= {})[k] ??= {}, t).value = value;
        return t;
    }, {}),
    result = getPathes(tree);

console.log(result);

The problem is:

It runs flawlessly in JSFiddle. But shows a "SyntaxError: missing : after property id" message in Acrobat Pro DC.
What is going wrong here? How can I correct the syntax?

TOPICS
JavaScript
478
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 16, 2023 Jan 16, 2023
LATEST

You seem to be using very modern JavaScript syntax not understood by Acrobat, based on an older JavaScript engine. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines