# All files / src/storages/string-array StringArrayStorage.ts

93.75% Statements 15/16
50% Branches 1/2
100% Functions 2/2
92.31% Lines 12/13

    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
    31
    32
    33
    34
    35
    36
    37
    38
    391x

    1x
    1x
    1x

    1x

    1812x

    1812x

    1812x

    1812x

    527x

    527x
    6177x

     import { injectable } from 'inversify';

    import { ArrayStorage } from '../ArrayStorage';
    import { RandomGeneratorUtils } from '../../utils/RandomGeneratorUtils';
    import { Utils } from '../../utils/Utils';

    @injectable()
    export class StringArrayStorage extends ArrayStorage <string> {
        constructor () {
            super();

            this.initialize();
        }

        /**
         * @param args
         */
        public initialize (...args: any[]): void {
            super.initialize(args);

            this.storageId = RandomGeneratorUtils.getRandomVariableName(4, false);
        }

        /**
         * @param rotationValue
         */
        public rotateArray (rotationValue: number): void {
            this.storage = Utils.arrayRotate(this.storage, rotationValue);
        }

        /**
         * @returns {string}
         */
        public toString (): string {
            return this.storage.map((value: string) => {
                return `'${value}'`;
            }).toString();
        }
    }