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

latching

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

latching - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

2

bower.json
{
"name": "latching",
"version": "0.9.1",
"version": "0.9.2",
"description": "Run-Time Hook Latching",

@@ -5,0 +5,0 @@ "main": "lib/latching.js",

{
"name": "latching",
"version": "0.9.1",
"version": "0.9.2",
"description": "Run-Time Hook Latching",

@@ -5,0 +5,0 @@ "keywords": [ "hook", "latch" ],

@@ -37,2 +37,26 @@

}
main () {
let options = [
{ names: [ "version", "v" ], type: "bool", "default": false,
help: "Print tool version and exit." },
{ names: [ "help", "h" ], type: "bool", "default": false,
help: "Print this help and exit." },
...
]
this.hook("cli-options", "none", options)
let parser = dashdash.createParser({
options: options,
})
...
}
log (level, msg) {
msg = this.hook("log-message", "pass", msg)
logger.log(level, msg)
}
login (username, password) {
...
if (!this.hook("access-allowed", "and", username, password))
throw new Error("access not allowed")
...
}
...

@@ -44,19 +68,33 @@ }

- `app-access.js`:
- `plugin-foo.js`:
```js
...
if (!app.hook("access-allowed", "and", user, password))
throw new Error("access not allowed")
...
/* extend applications CLI option parsing */
app.latch("cli-options", (options) => {
options.push({
names: [ "foo", "f" ], type: "bool", "default": false,
help: "Enable the Foo feature"
})
})
```
- `app-plugin-db.js`
- `plugin-geoip.js`:
```js
var id = app.latch("access-allowed", function (user, password) {
return db.user.findBy(user).sha1 === sha1(password)
/* extend applications logging with client location */
app.latch("log-message", (msg) => {
let location = ...
return `${msg}, location=${location}`
})
```
- `plugin-auth.js`
```js
/* extend application authentication strategy with a database variant */
app.latch("access-allowed", (username, password) => {
return db.user.findBy(username).sha1 === sha1(password)
})
```
Installation

@@ -63,0 +101,0 @@ ------------

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