Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move unwrapping methods to the primary underscore.js module #2860

Merged
merged 2 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,4 @@ export { default as chunk } from './chunk.js';
// These modules support the "object-oriented" calling style. See also
// `underscore.js` and `index-default.js`.
export { default as mixin } from './mixin.js';
export { default } from './underscore-oop.js';
export { default } from './underscore-array-methods.js';
13 changes: 0 additions & 13 deletions modules/underscore-oop.js → modules/underscore-array-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,4 @@ each(['concat', 'join', 'slice'], function(name) {
};
});

// Extracts the result from a wrapped and chained object.
_.prototype.value = function() {
return this._wrapped;
};

// Provide unwrapping proxies for some methods used in engine operations
// such as arithmetic and JSON stringification.
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;

_.prototype.toString = function() {
return String(this._wrapped);
};

export default _;
13 changes: 13 additions & 0 deletions modules/underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@ export default function _(obj) {
}

_.VERSION = VERSION;

// Extracts the result from a wrapped and chained object.
_.prototype.value = function() {
return this._wrapped;
};

// Provide unwrapping proxies for some methods used in engine operations
// such as arithmetic and JSON stringification.
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;

_.prototype.toString = function() {
return String(this._wrapped);
};
26 changes: 13 additions & 13 deletions underscore-esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore-esm.js.map

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions underscore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore.js.map

Large diffs are not rendered by default.