Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/randomatic/ |
Upload File : |
/*! * randomatic <https://github.com/jonschlinkert/randomatic> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ 'use strict'; var isNumber = require('is-number'); var typeOf = require('kind-of'); var mathRandom = require('math-random'); /** * Expose `randomatic` */ module.exports = randomatic; module.exports.isCrypto = !!mathRandom.cryptographic; /** * Available mask characters */ var type = { lower: 'abcdefghijklmnopqrstuvwxyz', upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', number: '0123456789', special: '~!@#$%^&()_+-={}[];\',.' }; type.all = type.lower + type.upper + type.number + type.special; /** * Generate random character sequences of a specified `length`, * based on the given `pattern`. * * @param {String} `pattern` The pattern to use for generating the random string. * @param {String} `length` The length of the string to generate. * @param {String} `options` * @return {String} * @api public */ function randomatic(pattern, length, options) { if (typeof pattern === 'undefined') { throw new Error('randomatic expects a string or number.'); } var custom = false; if (arguments.length === 1) { if (typeof pattern === 'string') { length = pattern.length; } else if (isNumber(pattern)) { options = {}; length = pattern; pattern = '*'; } } if (typeOf(length) === 'object' && length.hasOwnProperty('chars')) { options = length; pattern = options.chars; length = pattern.length; custom = true; } var opts = options || {}; var mask = ''; var res = ''; // Characters to be used if (pattern.indexOf('?') !== -1) mask += opts.chars; if (pattern.indexOf('a') !== -1) mask += type.lower; if (pattern.indexOf('A') !== -1) mask += type.upper; if (pattern.indexOf('0') !== -1) mask += type.number; if (pattern.indexOf('!') !== -1) mask += type.special; if (pattern.indexOf('*') !== -1) mask += type.all; if (custom) mask += pattern; // Characters to exclude if (opts.exclude) { var exclude = typeOf(opts.exclude) === 'string' ? opts.exclude : opts.exclude.join(''); exclude = exclude.replace(new RegExp('[\\]]+', 'g'), ''); mask = mask.replace(new RegExp('[' + exclude + ']+', 'g'), ''); if(opts.exclude.indexOf(']') !== -1) mask = mask.replace(new RegExp('[\\]]+', 'g'), ''); } while (length--) { res += mask.charAt(parseInt(mathRandom() * mask.length, 10)); } return res; };