-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #45
- Loading branch information
Showing
7 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
unsafe-perm=true | ||
save-prefix=~ | ||
shrinkwrap=false | ||
save=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# metascraper-lang | ||
|
||
[![npm](https://img.shields.io/npm/v/metascraper-lang.svg?style=flat-square)](https://www.npmjs.com/package/metascraper-lang) | ||
[![Dependency Status](https://david-dm.org/microlinkhq/metascraper.svg?path=packages/metascraper-lang&style=flat-square)](https://david-dm.org/microlinkhq/metascraper?path=packages/metascraper-lang) | ||
|
||
> Get lang property from HTML markup. | ||
## Install | ||
|
||
```bash | ||
$ npm install metascraper-lang --save | ||
``` | ||
|
||
## License | ||
|
||
**metascraper-lang** © [microlink.io](https://microlink.io), Released under the [MIT](https://github.com/microlinkhq/metascraper-lang/blob/master/LICENSE.md) License.<br> | ||
Authored and maintained by microlink.io with help from [contributors](https://github.com/microlinkhq/metascraper-lang/contributors). | ||
|
||
> [microlink.io](https://microlink.io) · GitHub [@microlink.io](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict' | ||
|
||
const { isString, toLower } = require('lodash') | ||
|
||
const wrap = rule => ({ htmlDom }) => { | ||
const value = rule(htmlDom) | ||
return isString(value) && toLower(value.substring(0, 2)) | ||
} | ||
|
||
module.exports = () => ({ | ||
lang: [ | ||
wrap($ => $('meta[property="og:locale"]').attr('content')), | ||
wrap($ => $('html').attr('lang')) | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "metascraper-lang", | ||
"description": "Get lang property from HTML markup", | ||
"homepage": "https://metascraper.js.org", | ||
"version": "0.0.0", | ||
"main": "index.js", | ||
"author": { | ||
"email": "[email protected]", | ||
"name": "Ian Storm Taylor" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-lang" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/microlinkhq/metascraper/issues" | ||
}, | ||
"dependencies": { | ||
"lodash": "~4.17.4" | ||
}, | ||
"devDependencies": { | ||
"standard": "latest" | ||
}, | ||
"engines": { | ||
"node": ">= 8" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"scripts": { | ||
"test": "exit 0" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters