Skip to content

Commit

Permalink
Rebuild browserified version
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Aug 1, 2012
1 parent 8c27026 commit d8cec14
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 13 deletions.
41 changes: 36 additions & 5 deletions demo/js/js-yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ if (!Array.prototype.forEach) {
};
}

if (!Array.prototype.map) {
Array.prototype.map = function (iterator, context) {
var result = [];
context = context || this;
this.forEach(function (val, key) {
result.push(iterator.call(context, val, key));
});
return result;
};
}

if (!Function.prototype.bind) {
Function.prototype.bind = function bind(context) {
var func = this;
Expand Down Expand Up @@ -80,7 +91,7 @@ var require = function (file, cwd) {
var cached = require.cache[resolved];
var res = cached? cached.exports : mod();
return res;
}
};

require.paths = [];
require.modules = {};
Expand Down Expand Up @@ -224,15 +235,28 @@ require.alias = function (from, to) {
;

var require_ = function (file) {
return require(file, dirname);
var requiredModule = require(file, dirname);
var cached = require.cache[require.resolve(file, dirname)];

if (cached.parent === null) {
cached.parent = module_;
}

return requiredModule;
};
require_.resolve = function (name) {
return require.resolve(name, dirname);
};
require_.modules = require.modules;
require_.define = require.define;
require_.cache = require.cache;
var module_ = { exports : {} };
var module_ = {
id : filename,
filename: filename,
exports : {},
loaded : false,
parent: null
};

require.modules[filename] = function () {
require.cache[filename] = module_;
Expand All @@ -245,6 +269,7 @@ require.alias = function (from, to) {
filename,
process
);
module_.loaded = true;
return module_.exports;
};
};
Expand Down Expand Up @@ -442,7 +467,12 @@ require.define("/package.json",function(require,module,exports,__dirname,__filen
require.define("/index.js",function(require,module,exports,__dirname,__filename,process){module.exports = require('./lib/js-yaml.js');
});

require.define("/lib/js-yaml.js",function(require,module,exports,__dirname,__filename,process){'use strict';
require.define("/lib/js-yaml.js",function(require,module,exports,__dirname,__filename,process){/**
* jsyaml
**/


'use strict';


var fs = require('fs');
Expand Down Expand Up @@ -500,6 +530,7 @@ jsyaml.safeLoadAll = function loadAll(stream, callback) {

/**
* jsyaml.addConstructor(tag, constructor[, Loader]) -> Void
*
* Add a constructor for the given tag.
*
* Constructor is a function that accepts a Loader instance
Expand Down Expand Up @@ -5005,7 +5036,7 @@ SafeConstructor.prototype.constructYamlTimestamp = function constructYamlTimesta
}
}

data = new Date(year, month, day, hour, minute, second, fraction);
data = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));

if (!!delta) {
data.setTime(data.getTime() - delta);
Expand Down
41 changes: 36 additions & 5 deletions js-yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ if (!Array.prototype.forEach) {
};
}

if (!Array.prototype.map) {
Array.prototype.map = function (iterator, context) {
var result = [];
context = context || this;
this.forEach(function (val, key) {
result.push(iterator.call(context, val, key));
});
return result;
};
}

if (!Function.prototype.bind) {
Function.prototype.bind = function bind(context) {
var func = this;
Expand Down Expand Up @@ -80,7 +91,7 @@ var require = function (file, cwd) {
var cached = require.cache[resolved];
var res = cached? cached.exports : mod();
return res;
}
};

require.paths = [];
require.modules = {};
Expand Down Expand Up @@ -224,15 +235,28 @@ require.alias = function (from, to) {
;

var require_ = function (file) {
return require(file, dirname);
var requiredModule = require(file, dirname);
var cached = require.cache[require.resolve(file, dirname)];

if (cached.parent === null) {
cached.parent = module_;
}

return requiredModule;
};
require_.resolve = function (name) {
return require.resolve(name, dirname);
};
require_.modules = require.modules;
require_.define = require.define;
require_.cache = require.cache;
var module_ = { exports : {} };
var module_ = {
id : filename,
filename: filename,
exports : {},
loaded : false,
parent: null
};

require.modules[filename] = function () {
require.cache[filename] = module_;
Expand All @@ -245,6 +269,7 @@ require.alias = function (from, to) {
filename,
process
);
module_.loaded = true;
return module_.exports;
};
};
Expand Down Expand Up @@ -442,7 +467,12 @@ require.define("/package.json",function(require,module,exports,__dirname,__filen
require.define("/index.js",function(require,module,exports,__dirname,__filename,process){module.exports = require('./lib/js-yaml.js');
});

require.define("/lib/js-yaml.js",function(require,module,exports,__dirname,__filename,process){'use strict';
require.define("/lib/js-yaml.js",function(require,module,exports,__dirname,__filename,process){/**
* jsyaml
**/


'use strict';


var fs = require('fs');
Expand Down Expand Up @@ -500,6 +530,7 @@ jsyaml.safeLoadAll = function loadAll(stream, callback) {

/**
* jsyaml.addConstructor(tag, constructor[, Loader]) -> Void
*
* Add a constructor for the given tag.
*
* Constructor is a function that accepts a Loader instance
Expand Down Expand Up @@ -5005,7 +5036,7 @@ SafeConstructor.prototype.constructYamlTimestamp = function constructYamlTimesta
}
}

data = new Date(year, month, day, hour, minute, second, fraction);
data = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));

if (!!delta) {
data.setTime(data.getTime() - delta);
Expand Down
Loading

0 comments on commit d8cec14

Please sign in to comment.