This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // At least one property | |
| type AtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & { | |
| [K in Keys]-?: Required<Pick<T, K>> | |
| }[Keys] | |
| type PerformanceBudget = AtLeastOne<{ fcp: number, lcp: number }> | |
| // Typed Key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [alias] | |
| acp = "!f() { git add . && git commit -m \"$1\" && git push; }; f" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Options: | |
| --abort-on-contradictory-flags (Disallow flags or implications overriding each other.) | |
| type: bool default: true | |
| --allow-overwriting-for-next-flag (temporary disable flag contradiction to allow overwriting just the next flag) | |
| type: bool default: false | |
| --use-strict (enforce strict mode) | |
| type: bool default: false | |
| --harmony (enable all completed harmony features) | |
| type: bool default: false | |
| --harmony-shipping (enable all shipped harmony features) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Options: | |
| --abort-on-contradictory-flags (Disallow flags or implications overriding each other.) | |
| type: bool default: true | |
| --allow-overwriting-for-next-flag (temporary disable flag contradiction to allow overwriting just the next flag) | |
| type: bool default: false | |
| --use-strict (enforce strict mode) | |
| type: bool default: false | |
| --harmony (enable all completed harmony features) | |
| type: bool default: false | |
| --harmony-shipping (enable all shipped harmony features) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function spyFactory(array, prepushHandler, postpushHandler) { | |
| const prepush = functionify(prepushHandler); | |
| const postpush = functionify(postpushHandler); | |
| const interceptor = { | |
| get: function (obj, prop) { | |
| if (prop !== 'push') { return obj[prop]; } | |
| return function (...args) { | |
| prepush(args); | |
| Array.prototype.push.apply(this, args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function spyFactory(array) { | |
| const interceptor = { | |
| get: function (obj, prop) { | |
| if (prop !== 'push') { return obj[prop]; } | |
| return function(...args) { | |
| console.log('prepush'); | |
| Array.prototype.push.apply(this, args); | |
| console.log('postpush'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function MyArray(arr) { | |
| const _arr = arr || []; | |
| this.push = function push(value) { | |
| console.log('prepush'); | |
| _arr.push(value) | |
| console.log('postpush'); | |
| } | |
| this.get = function getByIndex(index) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const originalPush = Array.prototype.push; | |
| Array.prototype.push = function newPush() { | |
| console.log('before push'); | |
| originalPush.call(this, arguments[0]); | |
| console.log('after push'); | |
| } | |
| let x = []; | |
| x.push('a'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Fix that gives ability to import json files without TypeScript errors | |
| declare module '*.json' { | |
| const value: any; | |
| export default value; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm version patch -m "Version %s - added more documentationc" |