lib/bit-field.js
/**
   * Checks if a given set of values or all given pairs of field name and value
   * are valid according to the schema.
   *
   * @param {AnyNumber|UnpackedInt} data pairs of field name and value to check
   * @returns {boolean} whether all pairs are valid
   * @example
   *
   * class Person extends BitField {}
   * Person.fields = [
   *  { name: 'age', size: 7 },
   *  { name: 'gender', size: 1 },
   * ];
   * Person.isValid({age: 100})
   * //=> true
   * Person.isValid({age: 100, gender: 3})
   * //=> false
   * Person.isValid([100, 1])
   * //=> true
   * Person.isValid([100, 3])
   * //=> false
   */
Checks if a given set of values or all given pairs of field name and value
are valid according to the schema.

@param {AnyNumber|UnpackedInt} data pairs of field name and value to check
@returns {boolean} whether all pairs are valid
@example


Checks if a given set of values or all given pairs of field name and value are valid according to the schema . @param { AnyNumber|UnpackedInt } data pairs of field name and value to check @returns { boolean } whether all pairs are valid @example
static isValid(data) {
    const { masks, fields } = this;
    const selectedFields = Array.isArray(data)
      ? fields.map((field, i) => [field.name, data[i]])
      : Object.entries(data);
    for (let i = 0; i < selectedFields.length; i++) {
      const [field, value] = selectedFields[i];
      if (((value & SIGN_BIT) !== value) || value > masks[field]) return false;
    }
    return true;
  }
static isValid ( data ) { const { masks , fields } = this ; const selectedFields = Array . isArray ( data ) ? fields . map ( ( field , i ) => [ field . name , data [ i ] ] ) : Object . entries ( data ) ; for ( let i = 0 ; i < selectedFields . length ; i ++ ) { const [ field , value ] = selectedFields [ i ] ; if ( ( ( value & SIGN_BIT ) !== value ) || value > masks [ field ] ) return false ; } return true ; }
Checks if a given set of values or all given pairs of field name and value
 are valid according to the schema.
Checks if a given set of values or all given pairs of field name and value are valid according to the schema .