@iotechpis/modules
```` npm i @iotechpis/modules -s ````
Last updated 3 months ago by iodevteam .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @iotechpis/modules 
SYNC missed versions from official npm registry.

@iotechpis/modules

Install

npm i @iotechpis/modules -s

How to use

Init

const express =  require("express");
const app =  express();

let config = {
	google:  {
		key: "290gn238xn2308x479txg2f2xfh2y8gfrxgfr"
	},
	nif_key:  "a0p239ynbo97tn2onv9a9",
	mongo_connection:  "mongodb://username:password@0.0.0.0:27017/db"
}

require("@iotechpis/modules").init(app, config, callback(?));

Email

.build(main_template, template, data)

let main_template = __dirname + "/EmailTemplates/main.hbs";
let template = __dirname + "/EmailTemplates/RegisterEmail.hbs";
let data = {} // data for your hanblebars template

let compiled = require("@iotechpis/modules").Email.build(main_template, template, data);
//returns the file/html compiled

.send(email_account, mail_options, callback)

let email_account = {
	host:  '',
	port:  587,
	secure:  false,
	auth: {
		user:  '',
		pass:  ''
	}
}

let mail_options = {
	from: '',
	to: '',
	cc: '',
	subject: '',
	html: ''
}

require("@iotechpis/modules").Email.send(email_account, mail_options, (error, info) => {
	if(error) console.error(error);
	console.log(info)
});

Location

.geocode(zip_code, callback)

let zip_code = "1000-004";

require("@iotechpis/modules").Location.geocode(zip_code, (result) => {
// result = {
	// address: "",
	// city: "",
	// region: "",
	// parish: "",
	// zip_code: "",
	// country: "",
	// coordinates: {
		// lat: "",
		// lng: ""
	// },
	// ids: {
		// level_1: "",
		// level_2: "",
		// level_3: ""
	// }
// }
});

.reverseGeocode(lat, lng, callback)

let lat = "39.319000";
let lng = "-7.600820";

require("@iotechpis/modules").Location.reverseGeocode(lat, lng, (result) => {
// result = {
	// address: "",
	// city: "",
	// region: "",
	// parish: "",
	// zip_code: "",
	// country: "",
	// coordinates: {
		// lat: "",
		// lng: ""
	// },
	// ids: {
		// level_1: "",
		// level_2: "",
		// level_3: ""
	// }
// }
});

.measureDistance(from, to, callback)

let from = "39.319000,-7.600820";
let to = "39.886558,-8.684137";

require("@iotechpis/modules").Location.measureDistance(from, to, (result) => {
// result = {
	//"text" : "182 km",
	//"value" : 181857
// }
});

.getIdsOfLocations(level3, level2, level1, callback)

let level3 = "Barreiros";
let level2 = "Amares";
let level1 = "Braga";

require("@iotechpis/modules").Location.getIdsOfLocations(level3, level2, level1, (level1_id, level2_id, level3_id) => {

});

Nif

.validateNIF(nif)

let nif = 123123123;

let isValid = require("@iotechpis/modules").Nif.validateNIF(nif);
//returns true or false

.company(body, callback)

let nif = 123123123;

require("@iotechpis/modules").Nif.findNif(nif, (result)=>{

// result= {
	// name: null,
	// location: {
		// zip_code: null,
		// route: null,
		// administrative_area_level_1: null,
		// administrative_area_level_2: null,
		// administrative_area_level_3: null,
		// coordinates: {
			// lat: null,
			// lng: null
		// }
	// },
	// contact: {
		// email: null,
		// phone: null,
		// website: null,
		// fax: null
	// }
// }

});

Current Tags

  • 1.0.8                                ...           latest (3 months ago)

9 Versions

  • 1.0.8                                ...           3 months ago
  • 1.0.7                                ...           3 months ago
  • 1.0.6                                ...           3 months ago
  • 1.0.5                                ...           5 months ago
  • 1.0.4                                ...           6 months ago
  • 1.0.3                                ...           6 months ago
  • 1.0.2                                ...           6 months ago
  • 1.0.1                                ...           6 months ago
  • 1.0.0                                ...           6 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 9
Last Month 11
Dependencies (7)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |