antsmartian / functional-es8 Goto Github PK
View Code? Open in Web Editor NEWContains code and snippets for Functional Programming in Javascript.
Contains code and snippets for Functional Programming in Javascript.
This is just in case anyone not versed in the handling of node gets to read this:
here is how to transpile your es6|es2015 code into javascript code supported by older browsers ($ represents the terminal input).
Used versions:
Node ($node --version
): v8.10.0 (use nvm or maybe a docker container for that specific version or try to reproduce with a newer version)
npm ($npm --version
): 5.8.0
npm init
initializes a new package.json which contains the neccessary information for your project (fill in as neccessary)babel
is not required anymore:[email protected]: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
2a. $npm install --save-dev [email protected]
- this installs the package locally for your project and lists the package with a version beginning with ^6.26 in the devDependencies section of your package.json (^ coming from regular expressions means that the version number has to start with 6.26, which means the major version is locked a 6 and the minor version is locked at 26; fix-number is the latest available at the time of installation. Mine was 0 (6.26.0), yours can be too but can also be 3 or 5).
2b. $npm install --save-dev [email protected]
- this package is neccessary to transpile your code into a version compatible to es5, since from babel version 6 onward, presets are no longer included.
info1 info2
3. Create a .babelrc file in the same directory as the package.json with the content:
{"presets":["env"]}
4. In your package.json place the following lines in the script section(remove the 2nd line with the explaining comment):
"scripts": {
"transpile": "./node_modules/.bin/babel script.js --out-file compiled-script.js"
// "<command to call>": "<path/to/babel-cli" <input.script> --out-file <location.of.output>"
},
You can choose any command you want instead of the transpile
. You might probably want to adapt the out-file path. Also check if your input script (in my case script.js
) matches the desired script you want to be compiled.
5. from your console|terminal call $npm run transpile
(or the command you have chosen)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.