Sha256: 9df2e1e93b68a9a077a39716b6d482cd854389faba01aaff5333a25281087a7e

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

// -----------------------------------------------------------------------------
// Error checks
// -----------------------------------------------------------------------------
// Table of contents:
// 1. Within
// 2. Outside

// -----------------------------------------------------------------------------
// 1. Within
// -----------------------------------------------------------------------------

/// Checks that it's being created within all of the passed $objs...
@function _should-be-called-within($objs...) {

    @each $obj in $objs {
        @if map-get($_bem-current-context, $obj) == null {
            @if $bem-throw-errors {
                @error 'It should be called within #{inspect($objs)}';
            }
            @return false;
        }
    }

    @return true;
}


// -----------------------------------------------------------------------------
// 2. Outside
// -----------------------------------------------------------------------------

/// Checks that it's being created outside all of the passed $objs...
@function _should-not-be-called-within($objs...) {

    @each $obj in $objs {
        @if map-get($_bem-current-context, $obj) != null {
            @if $bem-throw-errors {
                @error 'It should not be called within #{inspect($objs)}';
            }
            @return false;
        }
    }

    @return true;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bem-constructor-0.3.2 stylesheets/_error-checks.scss