Socket
Socket
Sign inDemoInstall

js-embedder

Package Overview
Dependencies
4
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    js-embedder

Embed code in JavaScript file.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
59.7 kB
Created
Weekly downloads
 

Readme

Source

js-embedder

向 JavaScript 文件中嵌入代码

const embedder = require('js-embedder');

embedder([
  {
    file: '待修改的文件绝对路径',
    embeds: [
      {
        insert: N,         // 在第 N 行之前,插入 code
        code: ...,         // 插入的代码
      },
      {
        replace: [X, Y],   // 从第 X 行到第 Y 行,替换为 code
        code: ...,         // 替换的代码
      },
      {
        insert: N,         // 优先使用 insert
        replace: [X, Y]    // replace 不起作用
        code: ...,
      },
    ],
  },
  {
    file: '待复原的文件绝对路径',
    embeds: null,          // 文件恢复到未修改状态
  }
]);

FAQs

Last updated on 08 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc