dust-usecontent-helper
Advanced tools
Comparing version 3.0.0 to 4.0.0-0
@@ -6,3 +6,3 @@ "use strict"; | ||
if (typeof lookup !== 'function' || lookup.length !== 3) { | ||
throw new TypeError("lookup function must be in the form function(locale, bundle, callback) { ... }"); | ||
throw new TypeError("lookup function must be in the form function(context, bundle, callback) { ... }"); | ||
} | ||
@@ -24,4 +24,3 @@ | ||
return chunk.map(function (chunk) { | ||
/* Accept either simply-named "locale" or paypal "locality" */ | ||
lookup(ctx.get('contextLocale') || ctx.get('contentLocality') || ctx.get('locale') || ctx.get('locality') || {}, params.bundle, function (err, content) { | ||
lookup(ctx, params.bundle, function (err, content) { | ||
if (err) { | ||
@@ -28,0 +27,0 @@ chunk.setError(err); |
{ | ||
"name": "dust-usecontent-helper", | ||
"version": "3.0.0", | ||
"version": "4.0.0-0", | ||
"description": "A dust helper to load i18n content at render time", | ||
@@ -13,5 +13,5 @@ "main": "index.js", | ||
"dust-message-helper": "^3.0.0", | ||
"dustjs-linkedin": "^2.4.2", | ||
"dustjs-linkedin": "~2.7.1", | ||
"tape": "^3.0.0" | ||
} | ||
} |
@@ -16,3 +16,4 @@ "use strict"; | ||
test('Does loader get called?', function (t) { | ||
require('../index')(function(locality, bundle, cont) { | ||
require('../index')(function(context, bundle, cont) { | ||
t.same(context.options.option, true); | ||
t.pass('loader got called'); | ||
@@ -25,3 +26,3 @@ cont(null, {"hello": "world"}); | ||
dustjs.loadSource(dustjs.compile('{@useContent bundle="test"}{@message key="hello" /}{/useContent}', 'test')); | ||
dustjs.render('test', {}, function (err, out) { | ||
dustjs.render('test', dustjs.context({}, { option: true }), function (err, out) { | ||
t.equal(out, "world"); | ||
@@ -28,0 +29,0 @@ t.pass("loader is called"); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7
3901
2