tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

context-menu-utils.js (852B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * The default format for the content copied to the
      9 *  clipboard when the `Copy Value` option is selected.
     10 */
     11 function baseCopyFormatter({ name, value, hasChildren }) {
     12  if (hasChildren) {
     13    return baseCopyAllFormatter({ [name]: value });
     14  }
     15  return `${value}`;
     16 }
     17 
     18 /**
     19 * The default format for the content copied to the clipboard when the `Copy All`
     20 * option is selected.
     21 *
     22 * @param {object} object The whole data object
     23 */
     24 function baseCopyAllFormatter(object) {
     25  return JSON.stringify(object, null, "\t");
     26 }
     27 
     28 module.exports = {
     29  contextMenuFormatters: {
     30    baseCopyFormatter,
     31    baseCopyAllFormatter,
     32  },
     33 };