ractivejs / rvc

RequireJS loader plugin for Ractive components
20 stars 10 forks source link

Fix:update rcu version to 0.4.2(previous version's base64Encode is broken) #16

Closed SiZapPaaiGwat closed 9 years ago

SiZapPaaiGwat commented 9 years ago

Current version's rcu's internal method base64Encode is broken. I have noticed that it has been fixed since 0.4.1.

code from rcu v0.4.2

  if ( typeof btoa === 'function' ) {
    base64Encode = function ( str ) {
        str = str.replace( /[^\x00-\x7F]/g, function ( char ) {
            var hex = char.charCodeAt( 0 ).toString( 16 );
            while ( hex.length < 4 ) hex = '0' + hex;

            return '\\u' + hex;
        });

        return btoa( str );
    };
  } else if ( typeof Buffer === 'function' ) {
    base64Encode = function ( str ) {
        return new Buffer( str, 'utf-8' ).toString( 'base64' );
    };
  } else {
    base64Encode = function () {};
  }

code from rcu v0.4.0

  if ( typeof btoa === 'function' ) {
    base64Encode = btoa;
  } else if ( typeof Buffer === 'function' ) {
    base64Encode = function ( str ) {
        return new Buffer( str, 'utf-8' ).toString( 'base64' );
    };
  } else {
    base64Encode = function () {};
  }
martypdx commented 9 years ago

@Rich-Harris Any reason not to merge this?

Rich-Harris commented 9 years ago

Just extreme disorganisation on my part. Have to run now, will publish to npm later if I can get on airport wifi... thanks @simongfxu!

Rich-Harris commented 8 years ago

Finally got round to publishing this to npm (as 0.4.0)

SiZapPaaiGwat commented 8 years ago

:+1: