lets-get-meta
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -7,4 +7,4 @@ var cheerio = require("cheerio") | ||
$("meta").each(function(i, tag){ | ||
var k = $(this).attr('name') | ||
var v = $(this).attr('content') | ||
var k = $(this).attr('name') || $(this).attr('property') | ||
var v = $(this).attr('content') | ||
if (k && v) meta[k] = v | ||
@@ -11,0 +11,0 @@ }) |
{ | ||
"name": "lets-get-meta", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Extract meta tags from an HTML string in Node.js (not browsers)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,4 +18,4 @@ # lets-get-meta | ||
// Pass and HTML string | ||
getMeta("<meta name='page' content='index'><meta name='description' content='This is the index page'>") | ||
// Pass an HTML string that includes name and/or property metatags | ||
getMeta("<meta name='page' content='index'><meta property='description' content='This is the index page'>") | ||
@@ -22,0 +22,0 @@ // Get back an object |
@@ -15,6 +15,7 @@ var assert = require("assert") | ||
it("extracts name and content from meta tags in an HTML string and returns a key-value object", function() { | ||
it("extracts name or property and its content from meta tags in an HTML string and returns a key-value object", function() { | ||
assert.deepEqual(m(fixtures.simple), { | ||
foo: "yes", | ||
bar: "no" | ||
bar: "no", | ||
'og:title': 'page title' | ||
}) | ||
@@ -21,0 +22,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4417
42