Skip to content

kosperera/vanilla-js-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanilla JavaScript { snippets }

JavaScript

I'm a huge nerd 🤓 of vanilla javascript (JS). I've built a few websites on it, as well as a few libraries and still has a long way to go to. This repository serves as a library of commonly used boilerplate code for all things vanilla javascript.

Read this article to learn more about this repository works.

On this repo

  • $qsa.js is to alias the document.querySelectorAll to traverse thru DOM elements
  • $.js is a micro-library for manipulating DOM as angular's $q
  • format-string.js is to replace strings as C# String.Format()
  • snake-case.js is to style strings to 'snake_case' as Lodash _.snakeCase()
  • mixin.js is to allow prototype option for helper functions as Lodash _.mixin()
  • script-data-src.js is magic code to replace <script> tags with attribute data-src with new HTMLScripElement

Learning Resources

Documenting javascript

Coding style

Differences between .call() and .apply()

Using prototype

Building libraries as modules (.mjs)

Namespace and IIFE for JS libraries

Building JS micro-libraries

Testing performance

Contributing

If you were wondering, I'd be happy to have more code snippets here. Have a suggestion or a bug fix? Just open a pull request or an issue. Include the code snippet with a clear file name and the simplest HTML possible.

License

Licensed under MIT

About

Library of commonly used boilerplate code for all things vanilla JS

Topics

Resources

License

Stars

Watchers

Forks