Sha256: c977f01f0efef0868723efc66b2cf1daf51cca98a34f9a8a4a815bf1ec9dc66c

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 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 {
            @return true;
        }
    }

    @if $bem-throw-errors {
        @error 'It should be called within #{inspect($objs)}';
    }

    @return false;
}


// -----------------------------------------------------------------------------
// 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.4.0 stylesheets/_error-checks.scss