Recupera todos arrays e retorna somente um com o valores.
No primeiro método há uma recursividade.
No segundo método, uma conversão para string, split e finalmente converte para um array final de números
Acho que pode ser útil também.
const arr = [ | |
{ | |
id: 10, | |
title: "Test 10", | |
item: "Item 1" | |
}, | |
{ | |
id: 10, | |
title: "Test 10", | |
item: "Item 2" |
import lazyLoadingRoutes from '../../support/lazyLoadingRoutes' | |
export default lazyLoadingRoutes([ | |
{ path: '/login', component: 'Login', meta: { requiresAuth: false } }, | |
{ path: '/forgotPassword', component: 'ForgotPassword', meta: { requiresAuth: false } }, | |
{ path: '/forgotEmail', component: 'ForgotEmail', meta: { requiresAuth: false } }, | |
{ path: '/createAccount', component: 'CreateAccount', meta: { requiresAuth: false } } | |
]) | |
module.exports = { | |
async signup(name, email, password) { | |
const exists = await models.user.findOne({ where: { email } }) | |
if (exists) { | |
throw new Error({ error: 'E-mail já existe. Tente se registrar com outro.' }) | |
} | |
const passwordEncrypted = await hashing(password) |
const getAll = userUID => | |
database | |
.ref('user_data') | |
.child(userUID) | |
.child('customers') | |
// exemplo de uso: | |
getAll(myUserId).on('value', snap => { | |
const value = snap.val() |
const create = (userUID, customerObj) => { | |
const ref = database | |
.ref('user_data') | |
.child(userUID) | |
.child('customers') | |
.push() | |
const {key} = ref | |
return ref.set(customerObj) |
function testaPost(){ | |
const url = '/includes/curl2.php' | |
const data = { | |
username: 'lubien', | |
password: '123456', | |
data: `<?xml version='1.0'?> | |
<methodCall> | |
<methodName>RequestServer.GetTableState</methodName> | |
<params> | |
<param> |
const CODE_A = 65 | |
const ALPHABET = [...Array.from({"length": 26}).keys()].map(key => String.fromCharCode(CODE_A + key)) | |
const getCharIndex = (letter) => letter.charCodeAt(0) - CODE_A | |
const findNextChar = (index) => (changeTo) => | |
ALPHABET[(index + changeTo) % 26] | |
const getChar = (char) => (changeTo = 0) => { | |
return getCharIndex(char) >= 0 | |
? findNextChar(getCharIndex(char))(changeTo) | |
: char | |
} |
const { | |
pipe, match, drop, head, range, map, identity, add | |
, equals, last, join, take, ifElse, adjust, always | |
} = require('ramda') | |
const leftPad = require('left-pad') | |
const leftPadZero = size => x => leftPad(x, size, '0') | |
const clockToFullHours = | |
pipe( | |
match(/^(\d{1,2}):(\d{2})(\w{2})$/i) |