Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 1.07 KB

validate.md

File metadata and controls

66 lines (44 loc) · 1.07 KB

Validate

This module is used for validateing article. Currently, you can check article by title checkIfExist. We are now working on Article validation by id

📃 TABLE OF CONTENT

🪣 Importing module

To set up this module to work , you have to import the module first.

import { Validate } from "wikifox";

Usage

checkIfExist

This method lets you check if article with specific title exist. It will also normalize the casing and all..

Validate.checkIfExists(<title>, <callback> [data])
Exmaple 1
import { Validate } from "wikifox";

var title = "Ethereum"
Validate.checkIfExists(title, (result) => {
	console.log(result);
});


/* OUTPUT */

{
  exist: true,
  title: 'Ethereum',
  id: 41754003,
  url: 'https://en.wikipedia.org/?curid=41754003'
}

Example 2

import { Validate } from "wikifox";

var title = "OhMyGawd-ThisDoesn'tExist";
Validate.checkIfExists(title, (result) => {
	console.log(result);
});

/* OUTPUT */
{
	exist: false;
}