New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@locustjs/extensions-options

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@locustjs/extensions-options

This library provides a helper ExtensionsOptionsHelper class that is used in other locustjs-extensions libraries

latest
Source
npmnpm
Version
2.2.2
Version published
Maintainers
2
Created
Source

About

This library provides a helper ExtensionHelper class that is used in other @locustjs/extensions-... libraries.

Options

ExtensionHelper constructor has two parameters:

ExtensionHelper(options, logger)

constructor parameters

ParameterTypeRequired
optionsobject, string, arrayyes
loggerobjectno

Structure of options as an object is as follows:

{
    "include": [...],
    "exclude": [...]
}

include specifies list of function names that are going to be extended on a target object. The default value is *. It says all functions should be extended.

exclude specifies list of function names that should be skipped or ignored and should be extended on the target obejct.

If a string or array is passed as options parameter to ExtensionHelper constructor, it is used as a value for includes property.

methods

methoddescription
configure(options)gets an options argument in the form of object, string or array, validate it and returns an options object
shouldExtend(fnName)Based on an options passed to current ExtensionHelper instance, checks whether given fnName should be extended or not and returns true or false.
extend(obj, fnName, fn)Checks whether fnName function could be extended or not and if so, extends fn function with the name fnName on given obj object.

Example

const eh = new ExtensionHelper('min, max')

eh.extend(Array, 'min', function () {
    ...
})

Keywords

locustjs

FAQs

Package last updated on 07 Feb 2025

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