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

bottender-compose

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottender-compose - npm Package Compare versions

Comparing version 0.12.2 to 0.12.3

16

CHANGELOG.md

@@ -0,1 +1,17 @@

# 0.12.3 / 2018-09-06
- [improve] improve warning when compiling template #82
##### Before:
```
Properties accessors in template is invalid -- expected return a string but got: object
```
##### After:
```
Properties accessors (context.session.user) in template is invalid -- expected return a non-empty string but got: object
```
# 0.12.2 / 2018-09-05

@@ -2,0 +18,0 @@

4

lib/__tests__/utils.spec.js

@@ -102,9 +102,9 @@ "use strict";

expectTemplate('Hi, {{context.session.user.first_name}}');
expect(warning).toBeCalledWith(true, 'Properties accessors in template is invalid -- expected return a string but got: string');
expect(warning).toBeCalledWith(true, 'Properties accessors (context.session.user.first_name) in template is invalid -- expected return a non-empty string but got: string');
});
it('should show warning when the result of properties accessors is not a string', () => {
expectTemplate('Hi, {{context.session.user}}').toBe('Hi, [object Object]');
expect(warning).toBeCalledWith(false, 'Properties accessors in template is invalid -- expected return a string but got: object');
expect(warning).toBeCalledWith(false, 'Properties accessors (context.session.user) in template is invalid -- expected return a non-empty string but got: object');
});
});
});

@@ -32,12 +32,14 @@ "use strict";

let value;
let properties;
if (firstWhitelistKey === 'param') {
value = get(param, otherResults[0].slice(1), '');
properties = otherResults[0].slice(1);
value = get(param, properties);
} else {
const properties = `${contextKeyPrefixResolveMap[firstWhitelistKey]}${otherResults[0].slice(1)}`;
value = get(context, properties, '');
properties = `${contextKeyPrefixResolveMap[firstWhitelistKey]}${otherResults[0].slice(1)}`;
value = get(context, properties);
}
warning(typeof value === 'string', `Properties accessors in template is invalid -- expected return a string but got: ${typeof value}`);
compiledResult = replace(compiledResult, targetString, value);
warning(value && typeof value === 'string', `Properties accessors (${firstWhitelistKey}.${properties}) in template is invalid -- expected return a non-empty string but got: ${typeof value}`);
compiledResult = replace(compiledResult, targetString, value || '');
templateRegExp.lastIndex = 0;

@@ -44,0 +46,0 @@ }

@@ -9,3 +9,3 @@ {

},
"version": "0.12.2",
"version": "0.12.3",
"main": "lib/index",

@@ -12,0 +12,0 @@ "files": [

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