New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-drupal-behaviors

Package Overview
Dependencies
Maintainers
10
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-drupal-behaviors - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

18

index.js
const template = require('babel-template');
function getRandomNumber(max) {
return Math.floor(Math.random() * Math.floor(max));
}
const randomNum = getRandomNumber(1000);
const drupalBehavior = template(`Drupal.behaviors.NAME = {attach: function (context, settings) {BODY}};`);
const drupalBehavior = template('Drupal.behaviors.behavior' + randomNum + ' = {attach: function (context, settings) {\nBODY;\n}};');
module.exports = function (babel) {

@@ -20,10 +15,13 @@ const t = babel.types;

this.drupalBehavior = true;
// console.log(path.node.body[0].expression.callee.body.directives)
function getRandomNumber(max) {
return Math.floor(Math.random() * Math.floor(max));
}
const randomNum = getRandomNumber(1000).toString();
const addBehavior = drupalBehavior({
NAME: t.identifier('name' + randomNum),
BODY: path.node.body
});
// console.log(path.get('body'))
// addBehavior.expression.callee.body.directives = path.node.directives;
path.replaceWith(

@@ -30,0 +28,0 @@ t.program([addBehavior])

{
"name": "babel-plugin-drupal-behaviors",
"version": "0.1.0",
"version": "0.1.1",
"description": "Babel Plugin to wrap file in a Drupal behavior",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc