This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| const fs = require('fs'); | |
| function getGoogleDriveEmbedLink(links = ``, nameFile = 'output.txt'){ | |
| links = links | |
| .split('\n') | |
| .map(link => link.toString().replace('https://drive.google.com/open?id=','')) | |
| .map(hash => `https://drive.google.com/file/d/${hash}/preview`) | |
| .reduce((output, input, index) => { | |
| return output += `\n${index + 1} | ${input}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable no-fallthrough */ | |
| const JapaneseLatin = { | |
| ba: "ба", | |
| cha: "ця", | |
| da: "да", | |
| ga: "га", | |
| ha: "ха", | |
| ja: "дзя", | |
| ka: "ка", | |
| ma: "ма", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const toHours = time => { | |
| const hours = new Date(time).getUTCHours() | |
| const minutes = time / 60 / 1000 | |
| let showMinutes | |
| if (minutes.toFixed(0) === '60') { | |
| showMinutes = '00' | |
| } else { | |
| if (minutes.toFixed(0).length === 1) { | |
| showMinutes = '0' + minutes.toFixed(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const convert = require("xml-js"); | |
| const getFile = name => { | |
| if (name === "en") { | |
| return `${process.cwd()}/app/src/main/res/values/strings.xml`; | |
| } | |
| return `${process.cwd()}/app/src/main/res/values-${name}/strings.xml`; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function asyncForEach(array, callback) { | |
| for (let index = 0; index < array.length; index++) { | |
| await callback(array[index], index, array); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function nFormatter(num, digits = 4): string { | |
| const si = [ | |
| { value: 1, symbol: '' }, | |
| { value: 1e3, symbol: 'K' }, | |
| { value: 1e6, symbol: 'M' }, | |
| { value: 1e9, symbol: 'G' }, | |
| { value: 1e12, symbol: 'T' }, | |
| { value: 1e15, symbol: 'P' }, | |
| { value: 1e18, symbol: 'E' }, | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const bytesToSize = (bytes, decimals = 2): string => { | |
| if (bytes === 0) return '0 Bytes' | |
| const k = 1024 | |
| const dm = decimals < 0 ? 0 : decimals | |
| const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] | |
| const i = Math.floor(Math.log(bytes) / Math.log(k)) | |
| return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const convertTime = (time): string => { | |
| const date = new Date(+`${time}000`) | |
| let hours = date.getHours() | |
| let minutes = date.getMinutes() | |
| const ampm = hours >= 12 ? 'PM' : 'AM' | |
| hours = hours % 12 | |
| hours = hours ? hours : 12 | |
| minutes = minutes < 10 ? '0' + minutes : minutes | |
| const strTime = hours + ':' + minutes + ' ' + ampm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function removeDublication(array, cb) { | |
| if (!array) { | |
| throw new Error("No array has been provided."); | |
| } | |
| if (!cb) { | |
| throw new Error("No callback has been provided."); | |
| } | |
| return array.reduce( | |
| (acc, value) => { | |
| const isExist = acc.some(v => cb(v, value)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getGDriveEmbed(id) { | |
| return `https://drive.google.com/file/d/${id}/preview` | |
| } |
OlderNewer