UNPKG

lux-framework

Version:

Build scalable, Node.js-powered REST APIs with almost no code.

22 lines (19 loc) 389 B
// @flow import { ResourceMismatchError } from '../errors'; import type { Request } from '../../../../server'; /** * @private */ export default function validateResourceId({ params: { id, data: { id: resourceId } } }: Request): true { if (id !== resourceId) { throw new ResourceMismatchError('data.id', String(id), String(resourceId)); } return true; }