i18next-express-middleware
Advanced tools
Comparing version 0.2.0 to 0.2.1
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.LanguageDetector = undefined; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
exports.handle = handle; | ||
@@ -10,6 +14,2 @@ exports.getResourcesHandler = getResourcesHandler; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _utils = require('./utils'); | ||
@@ -23,6 +23,8 @@ | ||
var LanguageDetector = _LanguageDetector2['default']; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.LanguageDetector = LanguageDetector; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var LanguageDetector = exports.LanguageDetector = _LanguageDetector2.default; | ||
function handle(i18next) { | ||
@@ -52,3 +54,3 @@ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
options = options || {}; | ||
if (typeof options !== 'object' && i18next.options.overloadTranslationOptionHandler && typeof i18next.options.overloadTranslationOptionHandler === 'function') { | ||
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && i18next.options.overloadTranslationOptionHandler && typeof i18next.options.overloadTranslationOptionHandler === 'function') { | ||
options = i18next.options.overloadTranslationOptionHandler(arguments); | ||
@@ -95,6 +97,4 @@ } | ||
}; | ||
} | ||
}; | ||
; | ||
function getResourcesHandler(i18next, options) { | ||
@@ -136,6 +136,4 @@ options = options || {}; | ||
}; | ||
} | ||
}; | ||
; | ||
function missingKeyHandler(i18next, options) { | ||
@@ -155,4 +153,2 @@ options = options || {}; | ||
}; | ||
} | ||
; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _utils = require('./utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var utils = _interopRequireWildcard(_utils); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _cookie = require('./languageLookups/cookie'); | ||
var _utils = require('./utils'); | ||
var _cookie2 = _interopRequireDefault(_cookie); | ||
var utils = _interopRequireWildcard(_utils); | ||
var _querystring = require('./languageLookups/querystring'); | ||
var _languageLookupsCookie = require('./languageLookups/cookie'); | ||
var _querystring2 = _interopRequireDefault(_querystring); | ||
var _languageLookupsCookie2 = _interopRequireDefault(_languageLookupsCookie); | ||
var _path = require('./languageLookups/path'); | ||
var _languageLookupsQuerystring = require('./languageLookups/querystring'); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _languageLookupsQuerystring2 = _interopRequireDefault(_languageLookupsQuerystring); | ||
var _header = require('./languageLookups/header'); | ||
var _languageLookupsPath = require('./languageLookups/path'); | ||
var _header2 = _interopRequireDefault(_header); | ||
var _languageLookupsPath2 = _interopRequireDefault(_languageLookupsPath); | ||
var _session = require('./languageLookups/session'); | ||
var _languageLookupsHeader = require('./languageLookups/header'); | ||
var _session2 = _interopRequireDefault(_session); | ||
var _languageLookupsHeader2 = _interopRequireDefault(_languageLookupsHeader); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _languageLookupsSession = require('./languageLookups/session'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var _languageLookupsSession2 = _interopRequireDefault(_languageLookupsSession); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -54,3 +54,3 @@ function getDefaults() { | ||
var LanguageDetector = (function () { | ||
var LanguageDetector = function () { | ||
function LanguageDetector(services) { | ||
@@ -78,7 +78,7 @@ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
this.addDetector(_languageLookupsCookie2['default']); | ||
this.addDetector(_languageLookupsQuerystring2['default']); | ||
this.addDetector(_languageLookupsPath2['default']); | ||
this.addDetector(_languageLookupsHeader2['default']); | ||
this.addDetector(_languageLookupsSession2['default']); | ||
this.addDetector(_cookie2.default); | ||
this.addDetector(_querystring2.default); | ||
this.addDetector(_path2.default); | ||
this.addDetector(_header2.default); | ||
this.addDetector(_session2.default); | ||
} | ||
@@ -135,7 +135,6 @@ }, { | ||
return LanguageDetector; | ||
})(); | ||
}(); | ||
LanguageDetector.type = 'languageDetector'; | ||
exports['default'] = LanguageDetector; | ||
module.exports = exports['default']; | ||
exports.default = LanguageDetector; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _cookies = require('cookies'); | ||
@@ -13,3 +11,5 @@ | ||
exports['default'] = { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = { | ||
name: 'cookie', | ||
@@ -24,3 +24,3 @@ | ||
} else { | ||
var cookies = new _cookies2['default'](req, res); | ||
var cookies = new _cookies2.default(req, res); | ||
found = cookies.get(options.lookupCookie); | ||
@@ -32,3 +32,2 @@ } | ||
}, | ||
cacheUserLanguage: function cacheUserLanguage(req, res, lng) { | ||
@@ -38,3 +37,3 @@ var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
if (options.lookupCookie && req !== 'undefined') { | ||
var cookies = new _cookies2['default'](req, res); | ||
var cookies = new _cookies2.default(req, res); | ||
@@ -50,3 +49,2 @@ var expirationDate = options.cookieExpirationDate; | ||
} | ||
}; | ||
module.exports = exports['default']; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = { | ||
exports.default = { | ||
name: 'header', | ||
@@ -58,3 +58,2 @@ | ||
} | ||
}; | ||
module.exports = exports['default']; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = { | ||
exports.default = { | ||
name: 'path', | ||
@@ -34,3 +34,2 @@ | ||
} | ||
}; | ||
module.exports = exports['default']; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _url = require('url'); | ||
@@ -13,3 +11,5 @@ | ||
exports['default'] = { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = { | ||
name: 'querystring', | ||
@@ -24,3 +24,3 @@ | ||
} else { | ||
var querystring = _url2['default'].parse(req.url, true); | ||
var querystring = _url2.default.parse(req.url, true); | ||
found = querystring.query[options.lookupQuerystring]; | ||
@@ -32,3 +32,2 @@ } | ||
} | ||
}; | ||
module.exports = exports['default']; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = { | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
exports.default = { | ||
name: 'session', | ||
@@ -12,3 +15,3 @@ | ||
if (options.lookupSession !== undefined && typeof req && req.session) { | ||
if (options.lookupSession !== undefined && (typeof req === 'undefined' ? 'undefined' : _typeof(req)) && req.session) { | ||
found = req.session[options.lookupSession]; | ||
@@ -19,3 +22,2 @@ } | ||
}, | ||
cacheUserLanguage: function cacheUserLanguage(req, res, lng) { | ||
@@ -28,3 +30,2 @@ var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
} | ||
}; | ||
module.exports = exports['default']; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -10,3 +10,2 @@ }); | ||
exports.removeLngFromUrl = removeLngFromUrl; | ||
function setPath(object, path, newValue) { | ||
@@ -13,0 +12,0 @@ var stack = undefined; |
{ | ||
"name": "i18next-express-middleware", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "express middleware for i18next", | ||
@@ -14,2 +14,6 @@ "main": "./lib/index.js", | ||
"bugs": "https://github.com/i18next/i18next-express-middleware/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/i18next/i18next-express-middleware.git" | ||
}, | ||
"dependencies": { | ||
@@ -20,23 +24,17 @@ "cookies": "0.5.1", | ||
"devDependencies": { | ||
"babel": "5.8.21", | ||
"babel-eslint": "4.1.0", | ||
"babel-cli": "6.0.0", | ||
"babel-core": "6.4.5", | ||
"babel-eslint": "5.0.0-beta6", | ||
"babel-preset-es2015": "6.3.13", | ||
"babel-preset-stage-0": "6.3.13", | ||
"chai": "2.3.0", | ||
"eslint": "1.2.1", | ||
"gulp": "3.9.0", | ||
"gulp-babel": "5.3.0", | ||
"gulp-bump": "1.0.0", | ||
"gulp-eslint": "1.0.0", | ||
"gulp-filter": "3.0.1", | ||
"gulp-git": "1.6.0", | ||
"gulp-if": "2.0.0", | ||
"gulp-prompt": "0.1.2", | ||
"gulp-tag-version": "1.3.0", | ||
"gulp-shell": "0.5.0", | ||
"mocha": "2.2.5", | ||
"sinon": "1.17.1", | ||
"watchify": "3.3.1", | ||
"yargs": "3.29.0" | ||
"sinon": "1.17.1" | ||
}, | ||
"scripts": { | ||
"test": "gulp test" | ||
"transpile": "babel src -d lib", | ||
"build": "npm run transpile", | ||
"version": "npm run build", | ||
"postversion": "git push && git push --tags && rm -rf build/temp" | ||
}, | ||
@@ -43,0 +41,0 @@ "author": "Jan Mühlemann <jan.muehlemann@gmail.com> (https://github.com/jamuhl)", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
22429
9
1
415