Fix example to work on Node v1 and earlier
'use strict';

var hasClass = require( '@stdlib/utils/detect-class-support' )();
var evil = require( './../lib' );

function compile( ctor ) {
	var name;
	var str;

	name = ctor.match( /^(\w*)Array$/ )[ 1 ];
	name = name + 'DataArray';

	str = '';
	str += '(function create(){';
	str += '"use strict";';

	if ( hasClass ) {
		str += 'class '+name+' extends '+ctor+'{';
		str += 'constructor(x){';
		str += 'super(x);';
		str += '}';
		str += '}';
	} else {
		str += 'function '+name+'(){';
		str += 'if (!(this instanceof '+name+')){';
		str += 'return new '+name+'();';
		str += '}';
		str += 'ctor.call(this);';
		str += 'return this;';
		str += '}';
		str += name+'.prototype = Object.create('+ctor+'.prototype);';
		str += name+'.prototype.constructor = '+name+';';
	}
	str += 'return '+name+';';
	str += '})();';
	return str;
}

var ctors;
var fcn;
var i;

ctors = [
	'Int8Array',
	'Uint8Array',
	'Uint8ClampedArray',
	'Int16Array',
	'Uint16Array',
	'Int32Array',
	'Uint32Array',
	'Float32Array',
	'Float64Array',
	'Array'
];

for ( i = 0; i < ctors.length; i++ ) {
	fcn = evil( compile( ctors[i] ) );
	console.log( fcn.toString() );
}

'use strict';

var evil = require( './../lib' );

function compile( ctor ) {
	var name;
	var str;

	name = ctor.match( /^(\w*)Array$/ )[ 1 ];
	name = name + 'DataArray';

	str = '';
	str += '(function create(){';
	str += '"use strict";';
	str += 'class '+name+' extends '+ctor+'{';
	str += 'constructor(x){';
	str += 'super(x);';
	str += '}';
	str += '}';
	str += 'return '+name+';';
	str += '})();';
	return str;
}

var ctors;
var fcn;
var i;

ctors = [
	'Int8Array',
	'Uint8Array',
	'Uint8ClampedArray',
	'Int16Array',
	'Uint16Array',
	'Int32Array',
	'Uint32Array',
	'Float32Array',
	'Float64Array',
	'Array'
];

for ( i = 0; i < ctors.length; i++ ) {
	fcn = evil( compile( ctors[i] ) );
	console.log( fcn.toString() );
}
