Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Refactor build data for clarity/consistency #81

Merged
merged 1 commit into from
Dec 12, 2016

Conversation

baer
Copy link
Contributor

@baer baer commented Dec 12, 2016

This PR makes 5 updates to the build-data.js script.

  • The package.json was changed to not rely on Babel. Node6 obviates the need for this 🎊 !
  • environments are passed to generateData making it a pure function of it's arguments
  • generateData was changed to use mapValues in place of Object.keys(obj).forEach(...)
  • Adding data for Opera was moved outside of a loop. Now it's only run once 🙃
  • Indentation of prototype methods was made to consistently be 2 spaces.

const fs = require("fs");
const path = require("path");

const flatten = require("lodash/flatten");
const flattenDeep = require("lodash/flattenDeep");
const mapValues = require("lodash/mapValues");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is my new favorite! I learned about it ~1mo ago. I just ❤️ lodash.

Copy link
Member

@hzoo hzoo Dec 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also Object.values and the new Object.entries if we wanted to use transform-runtime but don't have to. Or even polyfill since this is the build script.

// normalize some keys
.map((test) => envMap[test] || test)
.filter((test) => !isNaN(parseInt(test.replace(env, ""))))
.shift();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block + the one below it are whitespace only changes... I'm not sure why GitHub is showing it like this.

@hzoo hzoo merged commit 1e2de5f into master Dec 12, 2016
@hzoo
Copy link
Member

hzoo commented Dec 12, 2016

Cool 👍

@baer baer deleted the feature/update-build-data-for-clarity branch December 12, 2016 17:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants