lib/css-url-edit.js
function ( from_value, to_value ) {

        var type;

        if ( from_value instanceof RegExp ) {

            type = 'RegExp';

        } else if ( typeof from_value === 'string' ) {

            type = 'String';

        } else {

            throw { type: 'changeURLContent', message: 'First argument must be RegExp of String' };

        }

        if ( to_value === undefined ) {

            to_value = "";

        } else if( typeof to_value !== 'string' ) {

            throw { type: 'changeURLContent', message: 'Second argument must be String' };

        }

        urls.filter( function ( value ) {

            if ( type === "RegExp" ) {

                return from_value.test( _getURLValue( value ) );

            } else {

                return _getURLValue( value ).indexOf( from_value ) !== -1;

            }

        } ).forEach( function ( value ) {

            var new_value = _getURLValue( value ).replace( from_value, to_value );
            _setURLValue( value, new_value );

        } );

    }
function ( from_value, to_value ) {

        var type;

        if ( from_value instanceof RegExp ) {

            type = 'RegExp';

        } else if ( typeof from_value === 'string' ) {

            type = 'String';

        } else {

            throw { type: 'changeURLContent', message: 'First argument must be RegExp of String' };

        }

        if ( to_value === undefined ) {

            to_value = "";

        } else if( typeof to_value !== 'string' ) {

            throw { type: 'changeURLContent', message: 'Second argument must be String' };

        }

        urls.filter( function ( value ) {

            if ( type === "RegExp" ) {

                return from_value.test( _getURLValue( value ) );

            } else {

                return _getURLValue( value ).indexOf( from_value ) !== -1;

            }

        } ).forEach( function ( value ) {

            var new_value = _getURLValue( value ).replace( from_value, to_value );
            _setURLValue( value, new_value );

        } );

    }
function ( from_value , to_value ) { var type ; if ( from_value instanceof RegExp ) { type = 'RegExp' ; } else if ( typeof from_value === 'string' ) { type = 'String' ; } else { throw { type : 'changeURLContent' , message : 'First argument must be RegExp of String' } ; } if ( to_value === undefined ) { to_value = "" ; } else if ( typeof to_value !== 'string' ) { throw { type : 'changeURLContent' , message : 'Second argument must be String' } ; } urls . filter ( function ( value ) { if ( type === "RegExp" ) { return from_value . test ( _getURLValue ( value ) ) ; } else { return _getURLValue ( value ) . indexOf ( from_value ) !== - 1 ; } } ) . forEach ( function ( value ) { var new_value = _getURLValue ( value ) . replace ( from_value , to_value ) ; _setURLValue ( value , new_value ) ; } ) ; }
Replace content of every URL matching RegExp with new content.

@param  {regexp|string} or from_value Mask to select urls with.
@param  {string} to_value Rule to apply on found items.
Replace content of every URL matching RegExp with new content .