Skip to content

Instantly share code, notes, and snippets.

View maciejtrzcinski's full-sized avatar
👨‍🚀

Maciej Trzciński maciejtrzcinski

👨‍🚀
View GitHub Profile
export default {
setImage(state, image) {
Vue.set(state, 'images', image);
},
};
import getters from './getters'
import actions from './actions'
import mutations from './mutations'
const state = {
images: [],
status: null,
};
const namespaced = true;
import Vue from 'vue';
import Vuex from 'vuex';
import {images} from './modules/images';
Vue.use(Vuex);
export const store = new Vuex.Store({
modules: {
images,
}
Object.is(NaN, NaN); //true
NaN === NaN //false
' ' == 0 //true
null == undefined //true
[1] == true //true
if (!Object.is) {
Object.is = function(x, y) {
// SameValue algorithm
if (x === y) { // Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
['Hängt', 'Haut', 'Hüllen', 'Hubert'].sort(Intl.Collator().compare);
//["Hängt", "Haut", "Hubert", "Hüllen"] Good
['Hängt', 'Haut', 'Hüllen', 'Hubert'].sort(function (a, b) {
return a.localeCompare(b);
});
//["Hängt", "Haut", "Hubert", "Hüllen"] Good
['Hängt', 'Haut', 'Hüllen', 'Hubert'].sort();
// ["Haut", "Hubert", "Hängt", "Hüllen"] Bad