--- /dev/null
+#!/usr/bin/perl
+use strict; use warnings;
+
+use Data::Dumper;
+use OpenILS::Utils::Fieldmapper;
+
+my $map = $Fieldmapper::fieldmap;
+
+print <<JS;
+
+// ----------------------------------------------------------------
+// Autogenerated by fieldmapper.pl
+// ----------------------------------------------------------------
+
+JS
+
+for my $object (keys %$map) {
+
+my $short_name = $map->{$object}->{hint};
+
+print <<JS;
+
+// ----------------------------------------------------------------
+// Class: $short_name
+// ----------------------------------------------------------------
+
+JS
+
+print <<JS;
+function $short_name(array) {
+ if(array) { this.array = array; }
+ else { this.array = []; }
+}
+
+$short_name.prototype._is_array = function() {
+ return true;
+}
+JS
+
+for my $field (keys %{$map->{$object}->{fields}}) {
+
+my $position = $map->{$object}->{fields}->{$field}->{position};
+
+print <<JS;
+$short_name.prototype.$field = function(new_value) {
+ if(new_value) { this.array[$position] = new_value; }
+ return this.array[$position];
+}
+JS
+
+}
+}
+