Installations
npm install hapi-accept-language2
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.11.1
NPM Version
5.6.0
Score
69.6
Supply Chain
99.3
Quality
75.2
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
damusix
Download Statistics
Total Downloads
24,458
Last Day
1
Last Week
5
Last Month
18
Last Year
423
GitHub Statistics
8 Commits
2 Forks
1 Watching
2 Branches
1 Contributors
Bundle Size
2.13 kB
Minified
1.02 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.0.3
Package Id
hapi-accept-language2@2.0.3
Unpacked Size
10.34 kB
Size
2.92 kB
File Count
5
NPM Version
5.6.0
Node Version
8.11.1
Total Downloads
Cumulative downloads
Total Downloads
24,458
Last day
0%
1
Compared to previous day
Last week
25%
5
Compared to previous week
Last month
-40%
18
Compared to previous month
Last year
-60.5%
423
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Hapi-ly Accept Languages
Parses Accept-Language
header on requests for HapiJS and attaches them to request. Extracts language, region, script, and quality as per RFC-5646 best practices. Based on hapi-accept-language with better tests, options, and failovers; uses accept-language-parser. Special thanks to OpenTable for their work.
Installation
- Hapi 17:
npm install --save hapi-accept-language2
- Hapi 16:
npm install --save hapi-accept-language2@1
Usage
Hapi 17
1const Hapi = require('hapi'); 2 3const hapiAcceptLanguage = { 4 plugin: 'hapi-accept-language2', 5 options: { 6 7 // Set server default language using RFC-5646 language tags 8 // Optional 9 defaultLanguage: 'es-Latn-ES' 10 } 11}; 12 13 14server = new Hapi.Server({ port: 4111 }); 15 16server.route({ 17 18 method: 'GET', 19 path: '/', 20 handler: (request, reply) => { 21 22 return { 23 headers: request.raw.req.headers, 24 pre: request.pre, 25 languages: request.pre.language 26 } 27 } 28}); 29 30await server.register([hapiAcceptLanguage]); 31 32await server.start(/* ... */);
Hapi 16
1const Hapi = require('hapi'); 2 3const hapiAcceptLanguage = { 4 register: 'hapi-accept-language2', 5 options: { 6 7 // Set server default language using RFC-5646 language tags 8 // Optional 9 defaultLanguage: 'es-Latn-ES' 10 } 11}; 12 13server = new Hapi.Server(); 14server.connection({ port: 4111 }); 15 16server.route({ 17 18 method: 'GET', 19 path: '/', 20 handler: (request, reply) => { 21 22 reply({ 23 headers: request.raw.req.headers, 24 pre: request.pre, 25 languages: request.pre.language 26 }).code(200); 27 } 28}); 29 30server.register([hapiAcceptLanguage], {}, (err) => { 31 32 if (err) { 33 return done(err); 34 } 35 36 server.start(/* ... */); 37});
Contributing
git clone git://github.com/damusix/hapi-accept-language2.git
cd hapi-accept-language2
npm install
Please include tests and submit a pull request with your contributions.
Running Tests
npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/8 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2025-01-13
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More