Legend:
- ✏️ method changes
this. - 🔒 method does not change
this.
Array<T>.prototype.*:
concat(...items: Array): T[]🔒 ES3
| 5.32.176.0/21 | |
| 31.3.88.0/21 | |
| 31.7.168.0/21 | |
| 31.11.64.0/18 | |
| 31.12.16.0/20 | |
| 31.210.11.152/30 | |
| 37.25.80.0/21 | |
| 37.26.96.0/21 | |
| 38.19.1.28/30 | |
| 38.28.1.36/32 |
| "use strict"; | |
| [foo,bar] = TNG(foo,bar); | |
| // NOTE: intentionally not TNG(..) wrapping useBaz(), so that it's | |
| // basically like a "custom hook" that can be called only from other | |
| // TNG-wrapped functions | |
| function foo(origX,origY) { | |
| var [x,setX] = useState(origX); | |
| var [y,setY] = useState(origY); |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and
| /* | |
| * object.watch polyfill | |
| * | |
| * 2012-04-03 | |
| * | |
| * By Eli Grey, http://eligrey.com | |
| * Public Domain. | |
| * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
| */ |
| /* bling.js */ | |
| window.$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function (name, fn) { | |
| this.addEventListener(name, fn); | |
| } | |
| NodeList.prototype.__proto__ = Array.prototype; |
| import { h, Component } from 'preact'; | |
| /** Creates a new store, which is a tiny evented state container. | |
| * @example | |
| * let store = createStore(); | |
| * store.subscribe( state => console.log(state) ); | |
| * store.setState({ a: 'b' }); // logs { a: 'b' } | |
| * store.setState({ c: 'd' }); // logs { c: 'd' } | |
| */ |
| /* | |
| * This decorates Handlebars.js with the ability to load | |
| * templates from an external source, with light caching. | |
| * | |
| * To render a template, pass a closure that will receive the | |
| * template as a function parameter, eg, | |
| * T.render('templateName', function(t) { | |
| * $('#somediv').html( t() ); | |
| * }); | |
| * Source: https://github.com/wycats/handlebars.js/issues/82 |
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |