ez.js makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. The above package has some helper and very useful functions.
Typescript supported
#!/bin/bash | |
# ------------------------------------------------------------------------------------ # | |
# AWS CodeCommit to GitHub Migration Script | |
# Author: bhaireshm | |
# Date: 2024-10-28 | |
# Version: 1.0.0 | |
# Description: | |
# This script facilitates the seamless migration of repositories from AWS CodeCommit to GitHub. |
// app.js | |
const express = require('express'); | |
const http = require('http'); | |
const socketIO = require('socket.io'); | |
const mongoose = require('mongoose'); | |
const messageSchema = new mongoose.Schema({ | |
user: String, | |
text: String, | |
timestamp: { type: Date, default: Date.now }, |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Local IP Address</title> | |
</head> |
const { resolve, basename, join } = require("path"); | |
const { rm, existsSync, mkdirSync, writeFileSync, readFileSync } = require("fs"); | |
const prompt = require("prompt").start({ noHandleSIGINT: true }); | |
const helperFolderpath = resolve(__dirname, "helper"); | |
const base_url = "https://api.github.com/users"; | |
const headers = { Authorization: "" }; | |
let showLog = false; | |
let readJSON = true; // * Note: set this false to get the data latest from github. |
var prompt = require("prompt"); | |
var parseString = require("xml2js").parseString; | |
const path = require("path"); | |
const fs = require("fs"); | |
start(); | |
function start() { | |
prompt.start(); |
[ | |
{"id":"52180","Regn_no":"11","Acft_Type":"38L","Flight_no":"9W2662","Source":"ATQ","Destination":"DEL","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 10:45:00","STA":"2021-05-28 11:55:00","ETD":"","ETA":"","ATD":"","ABN":"","TDN":"","ATA":"","CargoSpace":"3000"}, | |
{"id":"52181","Regn_no":"11","Acft_Type":"38L","Flight_no":"9W2791","Source":"DEL","Destination":"ATQ","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 12:35:00","STA":"2021-05-28 13:45:00","ETD":"","ETA":"","ATD":"","ABN":"","TDN":"","ATA":"","CargoSpace":"3000"}, | |
{"id":"52182","Regn_no":"11","Acft_Type":"3JU","Flight_no":"9W0431","Source":"BOM","Destination":"IXE","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 13:05:00","STA":"2021-05-28 14:35:00","ETD":"","ETA":"","ATD":"","ABN":"","TDN":"","ATA":"","CargoSpace":"3000"}, | |
{"id":"52183","Regn_no":"11","Acft_Type":"38L","Flight_no":"9W0373","Source":"ATQ","Destination":"DEL","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 14:20:00","STA":"2021-05-28 15:30:00","ETD":"","ETA" |
ez.js makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. The above package has some helper and very useful functions.
Typescript supported
function getDatesInRange(startDate, endDate) { | |
if(!startDate || !endDate) return null; | |
startDate = new Date(startDate); | |
endDate = new Date(endDate); | |
const date = new Date(startDate.getTime()); | |
const dates = []; | |
while (date <= endDate) { | |
dates.push(new Date(date)); |
/** | |
* Get nested value from the given object. It checks for the key first then returns the value. | |
* | |
* @param {object} d | |
* @param {string} k - key name separated by dot character | |
* @example | |
* const data = { | |
pid: 'some-id', | |
portions: { name: 'section' } |
/** | |
* Data formatter - rename/customise keyname and values as you require, even nested keys and nested values can be defined. | |
* | |
* @param {object} obj - data to be formateted | |
* @param {string} formatter - key:valuePath, each key value is separated by comma | |
* @example "alterName:key" or "alterName:nested.key" or "nested.alterName:key" or "nested.alterName:nested.key" | |
* @param {object} options | |
* @param {object} options.error - default true, returns error content if any key or value is not found | |
* @param {object} options.oldData - default true, returns object | |
* @returns return modified object along with the provided object |