How to use ve-api-check - 10 common examples

To help you get started, we’ve selected a few ve-api-check examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeselaGen / openVectorEditor / app / cerebral / actions / toggleAnnotationDisplay.js View on Github external
export default function toggleAnnotationDisplay({input: {type}, state, output}) {
    ac.throw(ac.type, type);
    var capitalizedType = capitalize({type});
    // console.log(capitalizedType);

    if (state.get('show' + capitalizedType)) {
        state.set('show' + capitalizedType, false);
        // console.log("set false");
    } else {
        state.set('show' + capitalizedType, true);
        // console.log("set true");
    }
}
github TeselaGen / openVectorEditor / app / cerebral / actions / insertSequenceData.js View on Github external
export default function insertSequenceData({input, state, output}) {
    var { newSequenceData } = input;
    // console.log("input passed to insert is " + newSequenceData);
    var { sequenceData, caretPosition } = state.get();
    ac.throw(ac.posInt, caretPosition)
    ac.throw(ac.sequenceData, sequenceData)

    state.set('sequenceData', assign({}, sequenceData, insertSequenceDataAtPosition(newSequenceData, sequenceData, caretPosition)));
    state.set('caretPosition', newSequenceData.sequence.length + caretPosition);
}
github TeselaGen / openVectorEditor / app / cerebral / actions / insertSequenceData.js View on Github external
export default function insertSequenceData({input, state, output}) {
    var { newSequenceData } = input;
    // console.log("input passed to insert is " + newSequenceData);
    var { sequenceData, caretPosition } = state.get();
    ac.throw(ac.posInt, caretPosition)
    ac.throw(ac.sequenceData, sequenceData)

    state.set('sequenceData', assign({}, sequenceData, insertSequenceDataAtPosition(newSequenceData, sequenceData, caretPosition)));
    state.set('caretPosition', newSequenceData.sequence.length + caretPosition);
}
github TeselaGen / openVectorEditor / app / ve-sequence-utils / getReverseComplementSequenceString.js View on Github external
module.exports = function getReverseComplementSequenceString (sequence) {
    ac.throw([ac.string],arguments);
    var reverseComplementSequenceString = "";
    for (var i = sequence.length - 1; i >= 0; i--) {
        var revChar = DNAComplementMap[sequence[i]];
        if (!revChar) {
            revChar = sequence[i];
            // throw new Error('trying to get the reverse compelement of an invalid base');
        }
        reverseComplementSequenceString+= revChar;
    }
    return reverseComplementSequenceString;
};
github TeselaGen / openVectorEditor / app / getXStartAndWidthOfRowAnnotation.js View on Github external
module.exports = function getXStartAndWidthOfRowAnnotation(range, bpsPerRow, charWidth) {
    ac.throw([ac.range, ac.posInt, ac.number], arguments);
    // 24 bps long: 
    // 
    // if (range.end + 1 - range.start > 0 && )
    // (range.end + 1 - range.start) % bpsPerRow
    return {
        xStart: (range.start % bpsPerRow) * charWidth,
        width: ((range.end + 1 - range.start)) * charWidth,
    };
};
github TeselaGen / openVectorEditor / app / ve-range-utils / normalizePositionByRangeLength.js View on Github external
module.exports = function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions) {
    //isInBetweenPositions refers to:
    // A T G C
    // 0 1 2 3    <--  isInBetweenPositions = false is counting the positions themselves
    //0 1 2 3 4   <--  isInBetweenPositions = true is counting the spaces between positions
    ac.throw([ac.number, ac.posInt, ac.bool], arguments);
    var position = pPosition;
    if (position < 0) {
        position += sequenceLength;
    } else if (position + (isInBetweenPositions ? 0 : 1) > sequenceLength) {
        position -= sequenceLength;
    }
    return position;
};
github TeselaGen / openVectorEditor / app / ve-sequence-utils / getComplementSequenceString.js View on Github external
module.exports = function getComplementSequenceString (sequence) {
    ac.throw([ac.string],arguments);
    var complementSeqString = "";
    for (var i = 0; i < sequence.length; i++) {
        var complementChar = DNAComplementMap[sequence[i]];
        if (!complementChar) {
            complementChar = sequence[i];
            // throw new Error('trying to get the reverse compelement of an invalid base');
        }
        complementSeqString+= complementChar;
    }
    return complementSeqString;
};
github TeselaGen / openVectorEditor / app / ve-sequence-utils / mapAnnotationsToRows.js View on Github external
module.exports = function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow) {
    ac.throw(ac.arrayOf(ac.shape({
        start: ac.posInt,
        end: ac.posInt,
        // id: ac.oneOfType([ac.object, ac.string])
    })), annotations);
    ac.throw(ac.posInt, sequenceLength);
    ac.throw(ac.posInt, bpsPerRow);

    var annotationsToRowsMap = {};
    var yOffsetLevelMap = {};

    each(annotations, function(annotation) {
        mapAnnotationToRows(annotation, sequenceLength, bpsPerRow, annotationsToRowsMap, yOffsetLevelMap);
    });
    return annotationsToRowsMap;
};
github TeselaGen / openVectorEditor / app / cerebral / actions / addAnnotations.js View on Github external
export default function addAnnotations({input: {annotationType, annotationsToInsert, throwErrors}, state, output}) {
    ac.throw(ac.annotationType, annotationType);
    ac.throw(ac.arrayOf(ac.range), annotationsToInsert);
    ac.throw(ac.bool.optional, throwErrors);
    
    annotationsToInsert.forEach(function(annotationToInsert) {
        if (!isBoolean(annotationToInsert.forward)) {
            if (throwErrors) {
                throw new Error('annotation direction not specified')
            } else {
                console.log('annotation direction not specified')
                annotationToInsert.forward = true;
            }
        }
        if (!areNonNegativeIntegers([annotationToInsert.start])) {
            if (throwErrors) {
                throw new Error('annotation position not specified')
            } else {
github TeselaGen / openVectorEditor / app / actions / updateSelShiftHeldAndPreviousSel.js View on Github external
export default function updateSelShiftHeldAndPreviousSel({updatedCaretPos, sequenceLength, selectionLayer}, tree, output) {
    ac.throw(ac.object, selectionLayer);
    ac.throw(ac.number.optional, updatedCaretPos);
    ac.throw(ac.number.optional, sequenceLength);

    var oldCaretPos = getCaretFromSelection(selectionLayer);

    function getCaretFromSelection (selectionLayer) {
        if (selectionLayer.cursorAtEnd) {
            return selectionLayer.end + 1;
        } else {
            return selectionLayer.start;
        }
    }
    var newSelectionLayer = assign({}, selectionLayer);
    if (newSelectionLayer.cursorAtEnd) {
        newSelectionLayer.end = updatedCaretPos - 1;
        newSelectionLayer.end = trimNumberToFitWithin0ToAnotherNumber(newSelectionLayer.end, sequenceLength - 1);
        if (newSelectionLayer.end + 1 === selectionLayer.start && updatedCaretPos < oldCaretPos) {
            newSelectionLayer = false;

ve-api-check

our ve-specific implementation of api-check

ISC
Latest version published 9 years ago

Package Health Score

34 / 100
Full package analysis

Popular ve-api-check functions

Similar packages