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 safe64(data) { | |
if ( !Buffer.isBuffer(data) ) { | |
if (typeof data !== 'string') { | |
data = Buffer.from(JSON.stringify(data)).toString('base64'); | |
} | |
} else { | |
data = data.toString('base64'); | |
} | |
return data.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, ''); |
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 permutar(items, cb) { | |
var length = items.length, | |
c = new Array(length).fill(0), | |
i = 1, k, p, t = 0; | |
cb(items, ++t); | |
while (i < length) { | |
if (c[i] < i) { | |
k = i % 2 && c[i]; | |
p = items[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
"use strict"; | |
// ---------------------------------------------------------------------------- | |
const fs = require('fs'); | |
// ---------------------------------------------------------------------------- | |
const INPUT = 'palabrasRI.txt', | |
CRLF = '\n'; |