Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11x 1x 1x 10x 10x 1x 1x 1x 1x 1x 1x 1x 4x 1x 1x 3x 3x 1x | import { readFileSync } from 'fs';
/*
* Represents the Policy Statement.
*/
export class Statement {
/**
* Inline statement for policy
* @returns `InlineStatement` with inline statement.
* @param statement The actual statement
*/
public static fromInline(statement: string): string {
if (statement.length === 0) {
throw new Error('Policies inline statement cannot be empty');
}
return statement;
}
/**
* Loads the statement from a local disk path.
* @returns `DirectoryStatement` with statement from file path.
* @param path A path with the policy statement
*/
public static fromFile(path: string): string {
if (path.length === 0) {
throw new Error('Policy path cannot be empty');
}
return readFileSync(path, 'utf-8');
}
}
|