Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amphtml-validator-extra

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amphtml-validator-extra

Enhanced package of amphtml-validator.

  • 0.1.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

amphtml-validator-extra

Enhanced package of amphtml-validator.

It is possible to designate multiple URLs and file paths and verify them all together.

Use

const amphtmlValidator = require('amphtml-validator-extra');
const urls = [
    'https://example.com/article-01.html?amp',
    'https://example.com/article-02.html?amp',
    'https://example.com/article-03.html?amp'
];

amphtmlValidator.validateUrl(urls).then((result) => {
    console.log(result);
});
// [
//   status: 'PASS'
//   errors: [...]
// ],
// [
//   status: 'FAIL',
//   errors: [...]
// ],
// ...

Methods

validateHtml

amphtmlValidator.validateHtml('<html amp>...</html>').then((result) => {
    console.log(result);
});
ArgmentTypeDescription
htmlstringAMP HTML sourde

validateUrl

let urls = [
    'https://example.com/article-01.html?amp',
    'https://example.com/article-02.html?amp',
    'https://example.com/article-03.html?amp'
];

amphtmlValidator.validateUrl(urls).then((result) => {
    console.log(result);
});
ArgmentTypeDescription
urlsarray or stringAMP Page URL.
option.auth.userstringBasic auth user name.
option.auth.passwordstringBasic auth password.
option.progressfunctionProgress callback function.

validateFile

let urls = [
    './test/article-01.html',
    './test/article-02.html',
    './test/article-03.html'
];

amphtmlValidator.validateFile(urls).then((result) => {
    console.log(result);
});
ArgmentTypeDescription
urlsarray or stringAMP Page URL.
option.progressfunctionProgress callback function.

Option

Progress callback function.

progress

let urls = [
    'https://example.com/article-01.html?amp',
    'https://example.com/article-02.html?amp',
    'https://example.com/article-03.html?amp'
];
let option = {
    progress: (progress) => {
        console.log(`${progress.index} / ${progress.max}`);
    }
};

amphtmlValidator.validateUrl(urls, option).then((result) => {
    console.log(result);
});
/*
 * 1 / 3
 * 2 / 3
 * 3 / 3
 */

auth

let urls = [
    'https://example.com/auth/article-01.html?amp',
    'https://example.com/auth/article-02.html?amp',
    'https://example.com/auth/article-03.html?amp'
];

amphtmlValidator.validateUrl(urls, {
    auth: {
        user: 'username',
        password: 'password'
    }
}).then((result) => {
    console.log(result);
});

Lisence

MIT Lisence

Keywords

FAQs

Package last updated on 08 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc