_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q700
rename
train
function rename(source, destination) { const parent = path.dirname(destination); if (exists(destination)) { if (isDirectory(destination)) { destination = path.join(destination, path.basename(source)); } else { if (isDirectory(source)) { throw new Error(`Cannot rename directory ${source} into existing file ${destination}`); } } } else if
javascript
{ "resource": "" }
q701
getBlock
train
function getBlock(type) { switch (type) { case 'Radio': case 'Bool': return Radio; case 'Checkbox': return Checkbox; case 'Number': return Number; case 'Select': return Select; case 'Image': return Image; case 'Text': return Text; case 'Input': return Input; case 'Textarea': return Textarea; case 'Data': return Data; case 'Evaluation': return Evaluation; case 'FetchOrg': return FetchOrg; case 'Table':
javascript
{ "resource": "" }
q702
iniFileGet
train
function iniFileGet(file, section, key, options) { options = _.sanitize(options, {encoding: 'utf-8', default: ''}); if (!exists(file)) { return ''; } else if (!isFile(file)) { throw new Error(`File '${file}' is not
javascript
{ "resource": "" }
q703
sleep
train
function sleep(seconds) { const time = parseFloat(seconds, 10); if (!_.isFinite(time)) { throw new Error(`invalid
javascript
{ "resource": "" }
q704
ApiError
train
function ApiError(type, message, data) { this.name = 'ApiError'; this.type = type; this.message = message; this.data = data;
javascript
{ "resource": "" }
q705
stripPathElements
train
function stripPathElements(filePath, nelements, from) { if (!nelements || nelements <= 0) return filePath; from = from || 'start'; filePath = filePath.replace(/\/+$/, ''); let splitPath = split(filePath); if (from === 'start' && path.isAbsolute(filePath) && splitPath[0] === '/') splitPath = splitPath.slice(1); let start = 0;
javascript
{ "resource": "" }
q706
listDirContents
train
function listDirContents(prefix, options) { prefix = path.resolve(prefix); options = _.sanitize(options, {stripPrefix: false, includeTopDir: false, compact: true, getAllAttrs: false, include: ['*'], exclude: [], onlyFiles: false, rootDir: null, prefix: null, followSymLinks: false, listSymLinks: true}); const results = []; // TODO: prefix is an alias to rootDir. Remove it const root = options.rootDir || options.prefix || prefix; walkDir(prefix, (file, data) => { if (!matches(file, options.include, options.exclude)) return; if (data.type === 'directory' && options.onlyFiles) return; if (data.type === 'link' && !options.listSymLinks)
javascript
{ "resource": "" }
q707
getOwnerAndGroup
train
function getOwnerAndGroup(file) { const data = fs.lstatSync(file); const groupname = getGroupname(data.gid, {throwIfNotFound: false}) || null; const username = getUsername(data.uid,
javascript
{ "resource": "" }
q708
_chown
train
function _chown(file, uid, gid, options) { options = _.opts(options, {abortOnError: true}); uid = parseInt(uid, 10); uid = _.isFinite(uid) ? uid : getUid(_fileStats(file).uid, {refresh: false}); gid = parseInt(gid,
javascript
{ "resource": "" }
q709
chown
train
function chown(file, uid, gid, options) { if (!isPlatform('unix')) return; if (_.isObject(uid)) { options = gid; const ownerInfo = uid; uid = (ownerInfo.uid || ownerInfo.owner || ownerInfo.user || ownerInfo.username); gid = (ownerInfo.gid || ownerInfo.group); } options = _.sanitize(options, {abortOnError: true, recursive: false}); let recurse = false; try { if (uid) uid = getUid(uid, {refresh: false}); if (gid) gid = getGid(gid, {refresh: false}); if (!exists(file)) throw
javascript
{ "resource": "" }
q710
isPortInUse
train
function isPortInUse(port) { _validatePortFormat(port); if (isPlatform('unix')) { if (isPlatform('linux') && fileExists('/proc/net')) { return _isPortInUseRaw(port);
javascript
{ "resource": "" }
q711
load
train
function load(schema) { var obj; if (typeof schema == 'string' && schema !== 'null') { // This last predicate is to allow `avro.parse('null')` to work similarly // to `avro.parse('int')` and other primitives (null needs to be handled // separately since it is also a valid JSON identifier).
javascript
{ "resource": "" }
q712
createImportHook
train
function createImportHook() { var imports = {}; return function (fpath, kind, cb) { if (imports[fpath]) { // Already imported, return nothing to avoid duplicating attributes. process.nextTick(cb);
javascript
{ "resource": "" }
q713
pidFind
train
function pidFind(pid) { if (!_.isFinite(pid)) return false; try { if (runningAsRoot()) { return process.kill(pid, 0); } else {
javascript
{ "resource": "" }
q714
getGid
train
function getGid(groupname, options) { const gid = _.tryOnce(findGroup(groupname,
javascript
{ "resource": "" }
q715
getAttrs
train
function getAttrs(file) { const sstat = fs.lstatSync(file); return { mode: _getUnixPermFromMode(sstat.mode), type: fileType(file),
javascript
{ "resource": "" }
q716
addAuthHeaders
train
function addAuthHeaders ({ auth, bearerToken, headers, overrideHeaders=false, }) { if (overrideHeaders) return if (bearerToken) return { headers: { ...headers, Authorization: `Bearer ${ bearerToken }` } } if (auth) { const username = auth.username || '' const password = auth.password || ''
javascript
{ "resource": "" }
q717
getUid
train
function getUid(username, options) { const uid = _.tryOnce(findUser(username, options), 'id');
javascript
{ "resource": "" }
q718
includeCSRFToken
train
function includeCSRFToken ({ method, csrf=true, headers }) { if (!csrf || !CSRF_METHODS.includes(method)) return const token = getTokenFromDocument(csrf)
javascript
{ "resource": "" }
q719
HttpBackend
train
function HttpBackend() { this.requests = []; this.expectedRequests = []; const self = this; // All the promises our flush requests have returned. When all these promises are // resolved or rejected, there are no more flushes in progress. // For simplicity we never remove promises from this loop: this is a mock utility // for short duration tests, so this keeps it simpler. this._flushPromises = []; // the request function dependency that the SDK needs. this.requestFn = function(opts, callback) { const req = new Request(opts, callback); console.log(`${Date.now()} HTTP backend received request: ${req}`); self.requests.push(req); const abort = function() { const idx = self.requests.indexOf(req); if (idx >= 0) { console.log("Aborting HTTP request: %s %s", opts.method, opts.uri); self.requests.splice(idx, 1); req.callback("aborted"); } }; return { abort: abort, };
javascript
{ "resource": "" }
q720
train
function(opts) { opts = opts || {}; if (this.expectedRequests.length === 0) { // calling flushAllExpected when there are no expectations is a // silly thing to do, and probably means that your test isn't // doing what you think it is doing (or it is racy). Hence we // reject this, rather than resolving immediately. return Promise.reject(new Error( `flushAllExpected called with an empty expectation list`, )); } const waitTime = opts.timeout === undefined ? 1000 : opts.timeout; const endTime = waitTime + Date.now(); let flushed = 0; const iterate = () => { const timeRemaining = endTime - Date.now(); if (timeRemaining <= 0) { throw new Error( `Timed out after flushing ${flushed} requests; `+ `${this.expectedRequests.length} remaining`,
javascript
{ "resource": "" }
q721
train
function(method, path, data) { const pendingReq = new ExpectedRequest(method, path, data);
javascript
{ "resource": "" }
q722
ExpectedRequest
train
function ExpectedRequest(method, path, data) { this.method = method; this.path = path;
javascript
{ "resource": "" }
q723
train
function(code, data, rawBody) { this.response = { response: { statusCode: code, headers: { 'content-type': 'application/json',
javascript
{ "resource": "" }
q724
train
function(code, err) { this.response = { response: {
javascript
{ "resource": "" }
q725
Request
train
function Request(opts, callback) { this.opts = opts; this.callback = callback; Object.defineProperty(this, 'method', { get: function() { return opts.method; }, }); Object.defineProperty(this, 'path', { get: function() { return opts.uri; }, }); /** * Parse the body of the request as a JSON object and return it. */ Object.defineProperty(this, 'data', { get: function() { return opts.body ? JSON.parse(opts.body) : opts.body; }, }); /** * Return the raw body passed
javascript
{ "resource": "" }
q726
findUser
train
function findUser(user, options) { options = _.opts(options, {refresh: true, throwIfNotFound: true}); if (_.isString(user) && user.match(/^[0-9]+$/)) {
javascript
{ "resource": "" }
q727
forAsync
train
function forAsync(items, iter, callback) { var keys = Object.keys(items); var step = function (err, callback) { nextTick(function () { if (err) {
javascript
{ "resource": "" }
q728
getOptions
train
function getOptions(merge) { var options = { root: null, schemas: {}, add: [], formats: {}, fresh: false, multi: false, timeout: 5000,
javascript
{ "resource": "" }
q729
loadSchemaList
train
function loadSchemaList(job, uris, callback) { uris = uris.filter(function (value) { return !!value; }); if (uris.length === 0) { nextTick(function () { callback(); }); return; } var sweep = function () { if (uris.length === 0) { nextTick(callback); return; } forAsync(uris, function (uri, i, callback) { if (!uri) { out.writeln('> ' + style.error('cannot
javascript
{ "resource": "" }
q730
validateObject
train
function validateObject(job, object, callback) { if (typeof object.value === 'undefined') { var onLoad = function (err, obj) { if (err) { job.error = err; return callback(err); } object.value = obj; doValidateObject(job, object, callback); }; var opts = { timeout: (job.context.options.timeout || 5000) }; //TODO verify http:, file: and plain paths all load properly if (object.path) {
javascript
{ "resource": "" }
q731
addGroup
train
function addGroup(group, options) { options = _.opts(options, {gid: null}); if (!runningAsRoot()) return; if (!group) throw new Error('You must provide a group'); if (groupExists(group)) { return; } if (isPlatform('linux')) { _addGroupLinux(group, options); } else if (isPlatform('osx')) {
javascript
{ "resource": "" }
q732
assertProperties
train
function assertProperties(object, path, properties) { let errors = []; (properties || []).forEach((property) => { if (get(object, property, undefined) === undefined) { errors = [...errors, { path, id: object.id,
javascript
{ "resource": "" }
q733
assertDeprecations
train
function assertDeprecations(object, path, properties) { let errors = []; (properties || []).forEach(({ property, use }) => { if (get(object, property, undefined) !== undefined) {
javascript
{ "resource": "" }
q734
validatePage
train
function validatePage(page, path) { let errors = []; // Check for required properties errors = [...errors, ...assertProperties(page, path, requiredProperties[page.type])]; if (page.children) { // Check that children is an array if (!Array.isArray(page.children)) { errors = [...errors, { path, error: 'Children must be an array' }];
javascript
{ "resource": "" }
q735
prepend
train
function prepend(file, text, options) { options = _.sanitize(options, {encoding: 'utf-8'}); const encoding = options.encoding; if (!exists(file)) { write(file, text, {encoding: encoding}); } else {
javascript
{ "resource": "" }
q736
getHtml
train
function getHtml(methods) { return [ '<!doctype html>', '<html lang="en">', '<head>', '<title>API Index</title>', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>', '<link rel="stylesheet" href="//yastatic.net/bootstrap/3.1.1/css/bootstrap.min.css"/>',
javascript
{ "resource": "" }
q737
getMethodHtml
train
function getMethodHtml(method) { var params = method.getParams(); return [ '<h3>', method.getName(), '</h3>', method.getOption('executeOnServerOnly') && '<span class="label label-primary" style="font-size:0.5em;vertical-align:middle">server only</span>', '<p>', method.getDescription(), '</p>', Object.keys(params).length && [ '<table class="table table-bordered table-condensed">', '<thead>', '<tr>', '<th class="col-md-2">Name</th>', '<th class="col-md-2">Type</th>', '<th>Description</th>',
javascript
{ "resource": "" }
q738
getMethodParamHtml
train
function getMethodParamHtml(name, param) { return [ '<tr>', '<td>', name, param.required ?
javascript
{ "resource": "" }
q739
buildMethodName
train
function buildMethodName(req) { return [ req.params.service,
javascript
{ "resource": "" }
q740
eachLine
train
function eachLine(file, lineProcessFn, finallyFn, options) { if (arguments.length === 2) { if (_.isFunction(lineProcessFn)) { finallyFn = null; options = {}; } else { options = lineProcessFn; lineProcessFn = null; } } else if (arguments.length === 3) { if (_.isFunction(finallyFn)) { options = {}; } else { finallyFn = null; options = finallyFn; } } options = _.sanitize(options, {reverse: false, eachLine: null, finally: null, encoding: 'utf-8'}); finallyFn = finallyFn || options.finally; lineProcessFn = lineProcessFn || options.eachLine; const data = read(file, _.pick(options, 'encoding')); const lines
javascript
{ "resource": "" }
q741
write
train
function write(file, text, options) { options = _.sanitize(options, {encoding: 'utf-8', retryOnENOENT: true}); file = normalize(file); try { fs.writeFileSync(file, text, options); } catch (e) { if (e.code === 'ENOENT' && options.retryOnENOENT) { // If trying to create the parent failed, there is no point on retrying try {
javascript
{ "resource": "" }
q742
walkDir
train
function walkDir(file, callback, options) { file = path.resolve(file); if (!_.isFunction(callback)) throw new Error('You must provide a callback function'); options = _.opts(options, {followSymLinks: false, maxDepth: Infinity}); const prefix = options.prefix || file; function _walkDir(f, depth) { const type = fileType(f); const relativePath = stripPathPrefix(f, prefix); const metaData = {type: type, file: relativePath}; if (file === f) metaData.topDir = true; const result = callback(f, metaData);
javascript
{ "resource": "" }
q743
yamlFileGet
train
function yamlFileGet(file, keyPath, options) { if (_.isPlainObject(keyPath) && arguments.length === 2) { options = keyPath; keyPath = undefined; } options = _.sanitize(options, {encoding: 'utf-8', default: ''}); const
javascript
{ "resource": "" }
q744
setAttrs
train
function setAttrs(file, attrs) { if (isLink(file)) return; if (_.every([attrs.atime, attrs.mtime], _.identity)) { fs.utimesSync(file, new Date(attrs.atime),
javascript
{ "resource": "" }
q745
groupExists
train
function groupExists(group) { if (isPlatform('windows')) { throw new Error('Don\'t know how to check for group existence on
javascript
{ "resource": "" }
q746
readable
train
function readable(file) { if (!exists(file)) { return false; } else { try { fs.accessSync(file, fs.R_OK);
javascript
{ "resource": "" }
q747
readableBy
train
function readableBy(file, user) { if (!exists(file)) { return readableBy(path.dirname(file), user); } const userData = findUser(user); if (userData.id === 0) { return true; } else if
javascript
{ "resource": "" }
q748
writable
train
function writable(file) { if (!exists(file)) { return writable(path.dirname(file)); } else { try { fs.accessSync(file,
javascript
{ "resource": "" }
q749
writableBy
train
function writableBy(file, user) { function _writableBy(f, userData) { if (!exists(f)) { return _writableBy(path.dirname(f), userData); } else { return _accesibleByUser(userData, f, fs.W_OK);
javascript
{ "resource": "" }
q750
executable
train
function executable(file) { try { fs.accessSync(file, fs.X_OK); return true;
javascript
{ "resource": "" }
q751
executableBy
train
function executableBy(file, user) { if (!exists(file)) { return false; } const userData = findUser(user); if (userData.id === 0) { // Root can do anything but execute a file with no exec permissions const mode = fs.lstatSync(file).mode;
javascript
{ "resource": "" }
q752
split
train
function split(p) { const components = p.replace(/\/+/g, '/').replace(/\/+$/, '').split(path.sep); if (path.isAbsolute(p)
javascript
{ "resource": "" }
q753
join
train
function join() { const components = _.isArray(arguments[0]) ? arguments[0] : _.toArray(arguments);
javascript
{ "resource": "" }
q754
backup
train
function backup(source, options) { options = _.sanitize(options, {destination: null}); let dest =
javascript
{ "resource": "" }
q755
fromEuler
train
function fromEuler (q, euler) { var x = euler[0] var y = euler[1] var z = euler[2] var cx = Math.cos(x / 2) var cy = Math.cos(y / 2) var cz = Math.cos(z / 2) var sx = Math.sin(x / 2) var sy = Math.sin(y / 2) var sz = Math.sin(z / 2) q[0] = sx * cy * cz +
javascript
{ "resource": "" }
q756
yamlFileSet
train
function yamlFileSet(file, keyPath, value, options) { if (_.isPlainObject(keyPath)) { // key is keyMapping if (!_.isUndefined(options)) { throw new Error('Wrong parameters. Cannot specify a keymapping and a value at the same time.'); } if (_.isPlainObject(value)) { options = value; value = null; } else { options = {}; } } else if (!_.isString(keyPath) && !_.isArray(keyPath)) { throw new Error('Wrong parameter
javascript
{ "resource": "" }
q757
isFile
train
function isFile(file, options) { options = _.sanitize(options, {acceptLinks: true}); try {
javascript
{ "resource": "" }
q758
findGroup
train
function findGroup(group, options) { options = _.opts(options, {refresh: true, throwIfNotFound: true}); if (_.isString(group) && group.match(/^[0-9]+$/)) {
javascript
{ "resource": "" }
q759
addUser
train
function addUser(user, options) { if (!runningAsRoot()) return; if (!user) throw new Error('You must provide an username'); options = _.opts(options, {systemUser: false, home: null, password: null, gid: null, uid: null, groups: []}); if (userExists(user)) { return; } if (isPlatform('linux')) { _addUserLinux(user, options); } else if (isPlatform('osx')) { _addUserOsx(user,
javascript
{ "resource": "" }
q760
fromQuat
train
function fromQuat (v, q) { var sqx = q[0] * q[0] var sqy = q[1] * q[1] var sqz = q[2] * q[2] var sqw = q[3] * q[3] v[0] = Math.atan2(2 * (q[0] * q[3] - q[1] * q[2]), (sqw - sqx - sqy + sqz)) v[1]
javascript
{ "resource": "" }
q761
sendAjaxRequest
train
function sendAjaxRequest(url, data, execOptions) { var xhr = new XMLHttpRequest(); var d = vow.defer(); xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { d.resolve(JSON.parse(xhr.responseText)); } else { d.reject(xhr); } } }; xhr.ontimeout = function () { d.reject(new ApiError(ApiError.TIMEOUT, 'Timeout was reached while waiting for ' + url)); xhr.abort(); }; // shim for browsers which don't support timeout/ontimeout if (typeof xhr.timeout !== 'number' && execOptions.timeout) { var timeoutId = setTimeout(xhr.ontimeout.bind(xhr), execOptions.timeout); var oldHandler = xhr.onreadystatechange; xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE) {
javascript
{ "resource": "" }
q762
Api
train
function Api(basePath, options) { this._basePath = basePath; options = options || {}; this._options = { enableBatching: options.hasOwnProperty('enableBatching') ? options.enableBatching :
javascript
{ "resource": "" }
q763
train
function (methodName, params, execOptions) { execOptions = execOptions || {}; var options = { enableBatching: execOptions.hasOwnProperty('enableBatching') ? execOptions.enableBatching : this._options.enableBatching, timeout: execOptions.timeout || this._options.timeout };
javascript
{ "resource": "" }
q764
train
function (methodName, params, execOptions) { var defer = vow.defer(); var url = this._basePath + methodName; var data = JSON.stringify(params); sendAjaxRequest(url, data, execOptions).then(
javascript
{ "resource": "" }
q765
train
function (methodName, params, execOptions) { var requestId = this._getRequestId(methodName, params); var promise = this._getRequestPromise(requestId);
javascript
{ "resource": "" }
q766
train
function (execOptions) { var url = this._basePath + 'batch'; var data = JSON.stringify({methods: this._batch}); sendAjaxRequest(url, data, execOptions).then(
javascript
{ "resource": "" }
q767
train
function (defer, response) { var error = response.error; if (error) { defer.reject(new ApiError(error.type, error.message, error.data));
javascript
{ "resource": "" }
q768
train
function (batch, response) { var data = response.data; for (var i = 0, requestId; i < batch.length; i++) { requestId = this._getRequestId(batch[i].method, batch[i].params);
javascript
{ "resource": "" }
q769
train
function (defer, xhr) { var errorType = xhr.type || xhr.status; var errorMessage
javascript
{ "resource": "" }
q770
train
function (batch, xhr) { for (var i = 0, requestId; i < batch.length; i++) { requestId = this._getRequestId(batch[i].method, batch[i].params);
javascript
{ "resource": "" }
q771
append
train
function append(file, text, options) { options = _.sanitize(options, {atNewLine: false, encoding: 'utf-8'}); if (!exists(file)) { write(file, text,
javascript
{ "resource": "" }
q772
vowExec
train
function vowExec(cmd) { var defer = vow.defer(); exec(cmd, function (err, stdout, stderr) { if (err) {
javascript
{ "resource": "" }
q773
compareVersions
train
function compareVersions(fstVer, sndVer) { if (semver.lt(fstVer, sndVer)) { return 1; }
javascript
{ "resource": "" }
q774
commitAllChanges
train
function commitAllChanges(msg) { return vowExec(util.format('git commit -a -m "%s" -n', msg)) .fail(function (res) {
javascript
{ "resource": "" }
q775
changelog
train
function changelog(from, to) { return vowExec(util.format('git log --format="%%s" %s..%s', from, to))
javascript
{ "resource": "" }
q776
mdLogEntry
train
function mdLogEntry(version, log) { return util.format( '### %s\n%s\n\n', version, log.map(function
javascript
{ "resource": "" }
q777
iniFileSet
train
function iniFileSet(file, section, key, value, options) { options = _.sanitize(options, {encoding: 'utf-8', retryOnENOENT: true}); if (typeof key === 'object') { if (typeof value === 'object') { options = value; } else { options = {}; } } if (!exists(file)) { touch(file, '', options); } else if (!isFile(file)) { throw new Error(`File ${file} is not a file`); } const config = ini.parse(read(file, {encoding: options.encoding})); if (!_.isEmpty(section))
javascript
{ "resource": "" }
q778
puts
train
function puts(file, text, options) { options = _.sanitize(options,
javascript
{ "resource": "" }
q779
getPhotoUrl
train
function getPhotoUrl(data) { return FLICK_PHOTO_URL_TEMPLATE .replace('{farm-id}', data.farm) .replace('{server-id}', data.server)
javascript
{ "resource": "" }
q780
link
train
function link(target, location, options) { options = _.sanitize(options, {force: false}); if (options.force && isLink(location)) { fileDelete(location); } if (!path.isAbsolute(target)) { const cwd = process.cwd(); process.chdir(path.dirname(location));
javascript
{ "resource": "" }
q781
setDefaults
train
function setDefaults ({ headers={}, overrideHeaders=false, ...rest }) { return { ...DEFAULTS,
javascript
{ "resource": "" }
q782
deleteUser
train
function deleteUser(user) { if (!runningAsRoot()) return; if (!user) throw new Error('You must provide an username'); if (!userExists(user)) { return; } const userdelBin = _safeLocateBinary('userdel'); const deluserBin = _safeLocateBinary('deluser'); if (isPlatform('linux')) { if (userdelBin !== null) { // most modern systems runProgram(userdelBin, [user]); } else { if (_isBusyboxBinary(deluserBin)) { // busybox-based systems runProgram(deluserBin, [user]); } else { throw new Error(`Don't know how to delete user ${user} on this strange linux`); } }
javascript
{ "resource": "" }
q783
lookForBinary
train
function lookForBinary(binary, pathList) { let envPath = _.toArrayIfNeeded(pathList); if (_.isEmpty(envPath)) { envPath = (process.env.PATH || '').split(path.delimiter); } const foundPath = _.first(_.filter(envPath, (dir) => {
javascript
{ "resource": "" }
q784
parse
train
function parse(str, opts) { var parser = new Parser(str, opts); return
javascript
{ "resource": "" }
q785
Tokenizer
train
function Tokenizer(str) { this._str = str; this._pos = 0; this._queue = new BoundedQueue(3); // Bounded queue of last emitted tokens.
javascript
{ "resource": "" }
q786
Parser
train
function Parser(str, opts) { this._oneWayVoid = !!(opts && opts.oneWayVoid); this._reassignJavadoc = !!(opts && opts.reassignJavadoc); this._imports = [];
javascript
{ "resource": "" }
q787
reassignJavadoc
train
function reassignJavadoc(from, to) { if (!(from.doc instanceof Javadoc)) { // Nothing to transfer. return from; } to.doc = from.doc;
javascript
{ "resource": "" }
q788
xmlFileGet
train
function xmlFileGet(file, element, attributeName, options) { options = _.sanitize(options, {encoding: 'utf-8', retryOnENOENT: true, default: null}); const doc = loadXmlFile(file, options); const node =
javascript
{ "resource": "" }
q789
exists
train
function exists(file) { try { fs.lstatSync(file); return true; } catch (e) { if (e.code ===
javascript
{ "resource": "" }
q790
getOverloadedConfigFromEnvironment
train
function getOverloadedConfigFromEnvironment() { var env = typeof document === 'undefined' ? {} : document.documentElement.dataset; var platformUrl = env.zpPlatformUrl; var
javascript
{ "resource": "" }
q791
_gpfDefAttr
train
function _gpfDefAttr (name, base, definition) { var isAlias = name.charAt(0) === "$", fullName, result; if (isAlias) { name = name.substr(1); fullName = name + "Attribute"; } else { fullName = name;
javascript
{ "resource": "" }
q792
train
function (expectedClass) { _gpfAssertAttributeClassOnly(expectedClass); var result = new _gpfA.Array();
javascript
{ "resource": "" }
q793
train
function (to, callback, param) { _gpfObjectForEach(this._members, function (attributeArray, member) { member = _gpfDecodeAttributeMember(member); attributeArray._array.forEach(function (attribute) { if (!callback || callback(member, attribute, param)) {
javascript
{ "resource": "" }
q794
train
function (classDef) { var attributes, Super; while (classDef) { // !undefined && !null attributes = classDef._attributes; if (attributes) { attributes._copy(this); } Super = classDef._Super; if (Super === Object) { // Can't go upper
javascript
{ "resource": "" }
q795
train
function (member, attribute) { _gpfAssertAttributeOnly(attribute); member = _gpfEncodeAttributeMember(member); var array = this._members[member]; if (undefined === array) { array
javascript
{ "resource": "" }
q796
train
function (member) { member = _gpfEncodeAttributeMember(member); var result = this._members[member]; if (undefined === result || !(result
javascript
{ "resource": "" }
q797
train
function () { var result = []; _gpfObjectForEach(this._members, function (attributes, member) {
javascript
{ "resource": "" }
q798
loadFileAsString
train
function loadFileAsString(path, replaceWhiteSpaces){ var file = new java.io.File(path); var fr = new java.io.FileReader(file); var br = new java.io.BufferedReader(fr); var line; var lines = ""; while((line = br.readLine()) != null){
javascript
{ "resource": "" }
q799
getFilesList
train
function getFilesList(path, includes, excludes){ // Init default vars values includes = (includes === undefined || includes == null || includes == '') ? "**" : includes; excludes = (excludes === undefined || excludes == null || excludes == '') ? "" : excludes; var fs = project.createDataType("fileset"); fs.setDir(new java.io.File(path)); if(includes != ""){ fs.setIncludes(includes); } if(excludes != ""){
javascript
{ "resource": "" }