ducktype.js
function createRegExp (regexp, options) {
    return new DuckType({
      name: options && options.name || null,
      test: function (object) {
        return ((object instanceof String) || typeof(object) === 'string') && regexp.test(object);
      }
    });
  }
function createRegExp (regexp, options) {
    return new DuckType({
      name: options && options.name || null,
      test: function (object) {
        return ((object instanceof String) || typeof(object) === 'string') && regexp.test(object);
      }
    });
  }
function createRegExp ( regexp , options ) { return new DuckType ( { name : options && options . name || null , test : function ( object ) { return ( ( object instanceof String ) || typeof ( object ) === 'string' ) && regexp . test ( object ) ; } } ) ; }
Create a ducktype from a regular expression. The created ducktype
will check whether the provided object is a String,
and matches with the regular expression
@param {RegExp} regexp   A regular expression
@param {{name: String}} [options]
@returns {*}
Create a ducktype from a regular expression . The created ducktype will check whether the provided object is a String and matches with the regular expression