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

parse-latin

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-latin - npm Package Compare versions

Comparing version 0.4.0-rc.1 to 0.4.0-rc.2

121

lib/parse-latin.js

@@ -327,49 +327,100 @@ /**!

/**
* @param {string} key
* @param {Function|Array.<Function>} plugin
* @this {ParseLatin|Object}
* Factory to inject `plugins`. Takes `callback` for
* the actual inserting.
*
* @param {fucntion(Object, string, Array.<Function>)} callback
* @return {function(string, Array.<Function>)}
*/
parseLatinPrototype.use = function (key, plugin) {
var self,
wareKey;
self = this;
function useFactory(callback) {
/**
* Throw if the method is not pluggable.
* Validate if `plugins` can be inserted. Invokes
* the bound `callback` to do the actual inserting.
*
* @param {string} key - Method to inject on
* @param {Array.<Function>|Function} plugins - One
* or more plugins.
*/
if (!(key in self)) {
throw new Error(
'Illegal Invocation: Unsupported `key` for ' +
'`use(key, plugin)`. Make sure `key` is a ' +
'supported function'
);
}
return function (key, plugins) {
var self,
wareKey;
/**
* Fail silently when no plugin is given.
*/
self = this;
if (!plugin) {
return;
}
/**
* Throw if the method is not pluggable.
*/
wareKey = key + 'Plugins';
if (!(key in self)) {
throw new Error(
'Illegal Invocation: Unsupported `key` for ' +
'`use(key, plugins)`. Make sure `key` is a ' +
'supported function'
);
}
if (typeof plugin === 'function') {
plugin = [plugin];
} else {
plugin = plugin.concat();
}
/**
* Fail silently when no plugins are given.
*/
if (self[wareKey]) {
self[wareKey] = self[wareKey].concat(plugin);
} else {
self[wareKey] = plugin;
}
};
if (!plugins) {
return;
}
wareKey = key + 'Plugins';
/**
* Make sure `plugins` is a list.
*/
if (typeof plugins === 'function') {
plugins = [plugins];
} else {
plugins = plugins.concat();
}
/**
* Make sure `wareKey` exists.
*/
if (!self[wareKey]) {
self[wareKey] = [];
}
/**
* Invoke callback with the ware key and plugins.
*/
callback(self, wareKey, plugins);
};
}
/**
* Inject `plugins` to modifiy the result of the method
* at `key` on the operated on context.
*
* @param {string} key
* @param {Function|Array.<Function>} plugins
* @this {ParseLatin|Object}
*/
parseLatinPrototype.use = useFactory(function (context, key, plugins) {
context[key] = context[key].concat(plugins);
});
/**
* Inject `plugins` to modifiy the result of the method
* at `key` on the operated on context, before any other.
*
* @param {string} key
* @param {Function|Array.<Function>} plugins
* @this {ParseLatin|Object}
*/
parseLatinPrototype.useFirst = useFactory(function (context, key, plugins) {
context[key] = plugins.concat(context[key]);
});
/**
* Create a `WordNode` with its children set to a single

@@ -376,0 +427,0 @@ * `TextNode`, its value set to the given `value`.

{
"name": "parse-latin",
"version": "0.4.0-rc.1",
"version": "0.4.0-rc.2",
"description": "Latin-script (natural language) parser",

@@ -5,0 +5,0 @@ "license": "MIT",

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