Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@doars/doars-alias

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doars/doars-alias

Doars plugin for creating aliases or renaming any context or directive.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm @latest version minzipped size


@doars/doars-alias

Plugin for creating aliases or renaming any context or directive.

Install

From NPM

Install the package from NPM, then import and enable the library in your build.

npm i @doars/doars @doars/doars-alias
// Import library.
import Doars from '@doars/doars'
import DoarsAlias from '@doars/doars-alias'

// Setup a library instance.
const doars = new Doars()

// Setup the plugin.
const doarsAlias = new DoarsAlias(doars /*, options */)

// Enable library.
doars.enable()

IIFE build from jsDelivr

Add the IIFE build to the page from for example the jsDelivr CDN and enable the library.

<!-- Import library. -->
<script src="https://cdn.jsdelivr.net/npm/@doars/doars@1/dst/doars.iife.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@doars/doars-alias@1/dst/doars-alias.iife.js"></script>
<script type="application/javascript">
  document.addEventListener('DOMContentLoaded', () => {
    // Setup a library instance.
    const doars = new window.Doars()

    // Setup the plugin.
    const doarsAlias = window.DoarsAlias(doars /*, options */)

    // Enable library.
    doars.enable()
  })
</script>

ESM and IIFE builds are also available via the jsDelivr CDN.

Examples

// Setup a library instance.
const doars = new Doars()

// Setup the plugin.
const doarsAlias = new DoarsAlias(doars, {
  aliasContexts: {
    component: "root",
  },
  renameContexts: {
    references: "refs",
  },
  aliasDirective: {
    attribute: "attr",
    initialized: "init",
  },
  renameDirective: {
    reference: "ref",
  },
})

// Enable library.
doars.enable()

API

DoarsAlias

  • constructor Create plugin instance.
    • @param {Doars} library A doars library instance.
    • @param {Object} options = null See options.
    • @returns {DoarsAlias}
DoarsAlias options
  • {Object} aliasContexts The contexts to alias.
    • {Array<String>|String} [name] The alias or aliases of the context.
  • {Object} aliasDirectives The directives to alias.
    • {Array<String>|String} [name] The alias or aliases of the directive.
  • {Object} renameContexts The contexts to rename.
    • {String} [name] The new name of the context.
  • {Object} renameDirectives The directives to rename.
    • {String} [name] The new name of the directive.

Where [name] is the current name of the context or directive that should be aliased or renamed.

Compatible versions

@doars/doars-alias version@doars/doars version
1.x1.x
2.x2.x

Keywords

FAQs

Package last updated on 04 Oct 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc