Socket
Socket
Sign inDemoInstall

@loopback/context

Package Overview
Dependencies
9
Maintainers
7
Versions
192
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [2.1.1](https://github.com/strongloop/loopback-next/compare/@loopback/context@2.1.0...@loopback/context@2.1.1) (2020-02-06)
### Bug Fixes
* **context:** relax checking on instances of BindingKey class ([8668eb6](https://github.com/strongloop/loopback-next/commit/8668eb64b267e2644be87db92aeb86188d7e86f7))
# [2.1.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@2.0.0...@loopback/context@2.1.0) (2020-02-05)

@@ -8,0 +19,0 @@

19

dist/binding-filter.js

@@ -7,4 +7,13 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const binding_key_1 = require("./binding-key");
/**
* Check if an object is a `BindingKey` by duck typing
* @param selector Binding selector
*/
function isBindingKey(selector) {
if (selector == null || typeof selector !== 'object')
return false;
return (typeof selector.key === 'string' &&
typeof selector.deepProperty === 'function');
}
/**
* Type guard for binding address

@@ -14,3 +23,9 @@ * @param bindingSelector - Binding key or filter function

function isBindingAddress(bindingSelector) {
return (typeof bindingSelector === 'string' || bindingSelector instanceof binding_key_1.BindingKey);
return (typeof bindingSelector !== 'function' &&
(typeof bindingSelector === 'string' ||
// See https://github.com/strongloop/loopback-next/issues/4570
// `bindingSelector instanceof BindingKey` is not always reliable as the
// `@loopback/context` module might be loaded from multiple locations if
// `npm install` does not dedupe or there are mixed versions in the tree
isBindingKey(bindingSelector)));
}

@@ -17,0 +32,0 @@ exports.isBindingAddress = isBindingAddress;

4

package.json
{
"name": "@loopback/context",
"version": "2.1.0",
"version": "2.1.1",
"description": "LoopBack's container for Inversion of Control",

@@ -58,3 +58,3 @@ "engines": {

},
"gitHead": "b5e53892d327c6cf4c6023055d2b38f13fe4729e"
"gitHead": "6eea5e428b145cafb84a998bd53979da8c8fba07"
}

@@ -7,3 +7,3 @@ // Copyright IBM Corp. 2019. All Rights Reserved.

import {Binding, BindingTag} from './binding';
import {BindingAddress, BindingKey} from './binding-key';
import {BindingAddress} from './binding-key';
import {MapObject} from './value-promise';

@@ -55,2 +55,14 @@

/**
* Check if an object is a `BindingKey` by duck typing
* @param selector Binding selector
*/
function isBindingKey(selector: BindingSelector) {
if (selector == null || typeof selector !== 'object') return false;
return (
typeof selector.key === 'string' &&
typeof selector.deepProperty === 'function'
);
}
/**
* Type guard for binding address

@@ -63,3 +75,9 @@ * @param bindingSelector - Binding key or filter function

return (
typeof bindingSelector === 'string' || bindingSelector instanceof BindingKey
typeof bindingSelector !== 'function' &&
(typeof bindingSelector === 'string' ||
// See https://github.com/strongloop/loopback-next/issues/4570
// `bindingSelector instanceof BindingKey` is not always reliable as the
// `@loopback/context` module might be loaded from multiple locations if
// `npm install` does not dedupe or there are mixed versions in the tree
isBindingKey(bindingSelector))
);

@@ -66,0 +84,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc