Last active
October 24, 2024 13:19
-
-
Save danjm/ddcc3bc8e4fdfdb5ae71f18a68b60e8a to your computer and use it in GitHub Desktop.
Hellodash World
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'Hello, World!" with only lodash | |
// Either `var _ = require('lodash')`, OR | |
// Go to https://lodash.com/docs/4.17.15, open the dev console, copy, paste and execute the below code | |
_.each( | |
_.uniqBy(_.flatMap( | |
_.merge(_.groupBy(_.keys(_), _.head), _.groupBy(_.keys(_), _.last)), | |
_.rearg(_.over(_.identity, _.toUpper), _.toInteger(_.stubTrue())) | |
)), | |
_.flow( | |
_.over(_.stubObject, _.identity, _.constant), | |
_.spread(_.set), | |
_.bind(_.mixin, _) | |
) | |
) | |
_.mixin(_.set( | |
_.stubObject, | |
_.join(_.concat(_.l(), _.o(), _.S(), _.t(), _.r(), _.i(), _.n(), _.g()), _.stubString()), | |
_.flow( | |
_.concat, | |
_.partial( | |
_.map, | |
_, | |
_.cond(_.chunk(_.concat( | |
_.isFunction, _.unary(_.attempt), _.isString, _.identity | |
), _.add(_.stubTrue(), _.stubTrue()))) | |
), | |
_.partial(_.join, _, _.stubString()) | |
) | |
)) | |
_.mixin(_.set( | |
_.stubObject, | |
_.loString(_.m, _.i, _.x, _.l, _.o), | |
_.flow( | |
_.concat, | |
_.over( | |
_.flow(_.initial, _.spread(_.loString)), | |
_.last | |
), | |
_.spread(_.partial(_.set, _.stubObject())), | |
_.bind(_.mixin, _) | |
) | |
)) | |
_.mixlo( | |
_.c, _.o, _.n, _.s, _.t, _.r, _.u, _.c, _.t, _.o, _.r, | |
_.property(_.loString(_.c, _.o, _.n, _.s, _.t, _.r, _.u, _.c, _.t, _.o, _.r)) | |
) | |
_.mixlo( | |
_.f, _.r, _.o, _.m, _.C, _.h, _.a, _.r, _.C, _.o, _.d, _.e, | |
_.partial( | |
_.invoke, | |
_.constructor(_.stubString()), | |
_.loString(_.f, _.r, _.o, _.m, _.C, _.h, _.a, _.r, _.C, _.o, _.d, _.e) | |
) | |
) | |
_.mixlo( | |
_.s, _.e, _.t, _.N, _.e, _.w, _.W, _.i, _.t, _.h, | |
_.flow( | |
_.over( | |
_.stubObject, | |
_.unary(_.partial(_.join, _, _.stubString())), | |
_.nthArg(_.toInteger(_.stubTrue())) | |
), | |
_.spread(_.set) | |
) | |
) | |
_.mixlo( | |
_.s, _.e, _.t, _.N, _.e, _.w, _.W, _.i, _.t, _.h, _.L, _.o, | |
_.flow( | |
_.concat, | |
_.over(_.flow(_.initial, _.spread(_.loString)), _.last), | |
_.spread(_.setNewWith) | |
) | |
) | |
_.each( | |
_.concat( | |
_.setNewWithLo(_.z, _.e, _.r, _.o, _.add()), | |
_.setNewWithLo(_.o, _.n, _.e, _.toInteger(_.stubTrue())), | |
_.setNewWithLo(_.t, _.w, _.o, _.add(_.stubTrue(), _.stubTrue())), | |
_.setNewWithLo(_.t, _.h, _.r, _.e, _.e, _.subtract(_.size(_.toString(_.stubTrue())), _.stubTrue())), | |
_.setNewWithLo(_.f, _.o, _.u, _.r, _.size(_.toString(_.stubTrue()))), | |
_.setNewWithLo(_.f, _.i, _.v, _.e, _.size(_.toString(_.stubFalse()))), | |
_.setNewWithLo(_.s, _.i, _.x, _.add(_.size(_.toString(_.stubFalse())), _.stubTrue())), | |
_.setNewWithLo(_.s, _.e, _.v, _.e, _.n, _.subtract(_.size(_.head(_.words(_.toString(_.noop)))), _.stubTrue())), | |
_.setNewWithLo(_.e, _.i, _.g, _.h, _.t, _.size(_.head(_.words(_.toString(_.noop))))), | |
_.setNewWithLo(_.n, _.i, _.n, _.e, _.add(_.size(_.head(_.words(_.toString(_.noop)))), _.stubTrue())), | |
_.setNewWithLo(_.t, _.e, _.n, _.toInteger(_.join(_.concat(_.toInteger(_.stubTrue()), _.add()), _.stubString()))) | |
), | |
_.flow(_.partial(_.mapValues, _, _.constant), _.bind(_.mixin, _)) | |
) | |
_.mixlo( | |
_.e, _.x, _.p, _.o, _.n, _.e, _.n, _.t, | |
_.cond(_.chunk(_.concat( | |
_.overSome(_.partial(_.eq, _.one()), _.flip(_.partial(_.eq, _.zero()))), | |
_.one, | |
_.stubTrue, | |
_.flow( | |
_.flip(_.flow(_.over(_.unary(_.range), _.rearg(_.constant, _.one())), _.spread(_.map))), | |
_.partial(_.reduce, _, _.multiply, _.one()) | |
) | |
), _.two())) | |
) | |
_.mixlo( | |
_.m, _.i, _.x, _.C, _.h, _.a, _.r, | |
_.flow( | |
_.concat, | |
_.over( | |
_.flow(_.initial, _.spread(_.loString)), | |
_.flow(_.last, _.fromCharCode, _.constant) | |
), | |
_.spread(_.mixlo) | |
) | |
) | |
_.mixChar(_.c, _.o, _.m, _.m, _.a, _.add(_.exponent(_.six(), _.two()), _.eight())) | |
_.mixChar(_.s, _.p, _.a, _.c, _.e, _.exponent(_.two(), _.five())) | |
_.mixChar(_.e, _.x, _.c, _.l, _.a, _.m, _.a, _.t, _.i, _.o, _.n, _.add(_.exponent(_.two(), _.five()), _.one())) | |
_.mixChar(_.p, _.e, _.r, _.i, _.o, _.d, _.subtract(_.exponent(_.seven(), _.two()), _.three())) | |
_.mixlo( | |
_.l, _.o, _.g, | |
_.flow( | |
_.mixin, | |
_.property(_.loString(_.c, _.o, _.n, _.s, _.o, _.l, _.e, _.period, _.l, _.o, _.g)) | |
)() | |
) | |
_.log(_.loString(_.H, _.e, _.l, _.l, _.o, _.comma, _.space, _.W, _.o, _.r, _.l, _.d, _.exclamation)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment