function versionAsString(version) { return [ version.major, version.minor, version.patch, version.rev === 255 ? null : version.rev, ].filter(v => v != null).join('.'); }
// Update company info router.patch('/:id', auth, authz, async (ctx) => { try { await Company.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
edit(data) { return this.client.api .users('@me') .patch({ data }) .then(newData => { this.client.token = newData.token; const { updated } = this.client.actions.UserUpdate.handle(newData); if (updated) return updated; return this; }); }
function cleanPackageJSON() { const content = fs.readFileSync(pkgPath, "utf8") process.once("exit", () => fs.outputFileSync(pkgPath, content)) const pkgJSON = JSON.parse(content) for (const field of fieldsToRemove) { Reflect.deleteProperty(pkgJSON, field) } pkgJSON.scripts = defaultScripts fs.outputFileSync(pkgPath, fleece.patch(content, pkgJSON)) }
function expectVersionMetrics(metrics) { expect(metrics).toHaveLength(1); expect(metrics[0].help).toEqual('Node.js version info.'); expect(metrics[0].type).toEqual('gauge'); expect(metrics[0].name).toEqual('nodejs_version_info'); expect(metrics[0].values[0].labels.version).toEqual(nodeVersion); expect(metrics[0].values[0].labels.major).toEqual(versionSegments[0]); expect(metrics[0].values[0].labels.minor).toEqual(versionSegments[1]); expect(metrics[0].values[0].labels.patch).toEqual(versionSegments[2]); }
/** * The cache of Presences * @type {Collection<Snowflake, Presence>} * @name PresenceManager#cache */ add(data, cache) { const existing = this.cache.get(data.user.id); return existing ? existing.patch(data) : super.add(data, cache, { id: data.user.id }); }
// Update a rocket router.patch('/:id', auth, authz, async (ctx) => { try { await Rocket.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update a ship router.patch('/:id', auth, authz, async (ctx) => { try { await Ship.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update a dragon router.patch('/:id', auth, authz, async (ctx) => { try { await Dragon.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update a payload router.patch('/:id', auth, authz, async (ctx) => { try { await Payload.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true, }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update a user router.patch('/:id', auth, authz, async (ctx) => { try { await User.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true, }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update capsule router.patch('/:id', auth, authz, async (ctx) => { try { await Capsule.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update a launch router.patch('/:id', auth, authz, async (ctx) => { try { await Launch.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true, }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update a launchpad router.patch('/:id', auth, authz, async (ctx) => { try { await Launchpad.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });
// Update core router.patch('/:id', auth, authz, async (ctx) => { try { await Core.findByIdAndUpdate(ctx.params.id, ctx.request.body, { runValidators: true }); ctx.status = 200; } catch (error) { ctx.throw(400, error.message); } });