UNPKG

@designliquido/delegua

Version:

Linguagem de programação simples e moderna usando português estruturado.

90 lines 3.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const informacao_variavel_ou_constante_1 = require("../informacao-variavel-ou-constante"); exports.default = { aparar: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.trim()), }, apararFim: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.trimEnd()), }, apararInicio: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.trimStart()), }, concatenar: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, ...texto) => Promise.resolve(''.concat(...texto)), }, dividir: { tipoRetorno: 'texto[]', argumentos: [ new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('divisor', 'texto'), new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('limite', 'número') ], implementacao: (interpretador, texto, divisor, limite) => { if (limite) { return Promise.resolve(texto.split(divisor, limite)); } return Promise.resolve(texto.split(divisor)); }, }, fatiar: { tipoRetorno: 'texto', argumentos: [ new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('inicio', 'número'), new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('fim', 'número') ], implementacao: (interpretador, texto, inicio, fim) => Promise.resolve(texto.slice(inicio, fim)), }, inclui: { tipoRetorno: 'texto', argumentos: [ new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('elemento', 'texto') ], implementacao: (interpretador, texto, elemento) => Promise.resolve(texto.includes(elemento)), }, inverter: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.split('').reduce((texto, caracter) => (texto = caracter + texto), '')), }, maiusculo: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.toUpperCase()), }, minusculo: { tipoRetorno: 'texto', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.toLowerCase()), }, substituir: { tipoRetorno: 'texto', argumentos: [ new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('elemento', 'texto'), new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('substituto', 'texto') ], implementacao: (interpretador, texto, elemento, substituto) => Promise.resolve(texto.replace(elemento, substituto)), }, subtexto: { tipoRetorno: 'texto', argumentos: [ new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('inicio', 'número'), new informacao_variavel_ou_constante_1.InformacaoVariavelOuConstante('fim', 'número') ], implementacao: (interpretador, texto, inicio, fim) => Promise.resolve(texto.slice(inicio, fim)), }, tamanho: { tipoRetorno: 'número', argumentos: [], implementacao: (interpretador, texto) => Promise.resolve(texto.length), }, }; //# sourceMappingURL=primitivas-texto.js.map