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
    
  
  
    
  | Number.prototype.noun = function(c, f) { | |
| f || (f = true), c = c.split('|') | |
| let n = this.toString().substr(-2) | |
| let r = f ? this + ' ' : '' | |
| return r + c[0] + ((/^[0,2-9]?[1]$/.test(n)) ? c[2] : ((/^[0,2-9]?[2-4]$/.test(n)) ? c[3] : c[1])) | |
| } | |
| // (5).noun('огур|цов|ец|ца') => 5 огурцов | 
  
    
      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 len = array.length // some array and its length | |
| const idx = 0 // current index | |
| const updateIndex = (adj: number): number => (((idx + adj) % len) + len) % len | 
  
    
      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
    
  
  
    
  | export const deepFreeze = <T>(source: T, freezeParent = true): DRo<T> => { | |
| if (freezeParent) Object.freeze(source) | |
| Object.getOwnPropertyNames(source).forEach(function(prop) { | |
| if ( | |
| Object.prototype.hasOwnProperty.call(source as any, prop) && | |
| (source as any)[prop] !== null && | |
| (typeof (source as any)[prop] === 'object' || typeof (source as any)[prop] === 'function') | |
| ) { | |
| if (Object.isFrozen((source as any)[prop])) { | 
  
    
      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
    
  
  
    
  | /** | |
| * Convert string literal type to camelCase. | |
| */ | |
| declare type CamelCase<T extends string> = T extends `${infer P1}-${infer P2}` | |
| ? `${Lowercase<P1>}${Capitalize<P2>}` | |
| : Lowercase<T> | 
  
    
      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
    
  
  
    
  | /** | |
| * Utility type `Replace` replace substrings within string literal unions | |
| * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#tail-recursion-elimination-on-conditional-types | |
| */ | |
| type Replace<T extends string, S extends string, D extends string, | |
| A extends string = ""> = T extends `${infer L}${S}${infer R}` ? | |
| Replace<R, S, D, `${A}${L}${D}`> : `${A}${T}` | 
  
    
      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
    
  
  
    
  | registerPaint('smooth-corners', class { | |
| paint(ctx, size) { | |
| ctx.fillStyle = 'black' | |
| // n=4 draw a squircle | |
| const n = 4 | |
| let m = n | |
| if (n > 100) m = 100 | |
| if (n < 0.00000000001) m = 0.00000000001 |