1.0.3 • Published 4 years ago

funny-accidents v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

funny-accidents

We don't make mistakes, only happy little accidents.

  • Bob Ross

inspired by Jake Archibald's tweet, and by my own old pet project, when i was kinda obsessed with the syntax of pug (it was called jade back then).

install

install funny-accidents with npm or yarn:

$ npm install funny-accidents
# or
$ yarn add funny-accidents

usage

allow happy little accidents in the global scope:

import 'funny-accidents';

consloe.log('hello');
cnosole.log('ehlo');
consoel.log('hola');

allow happy little mistakes on a specific object:

import patch from 'funny-accidents/patch'

const user = {
  name: 'John Doe',
};

patch(user);

console.log(user.naem);

how does this work?

it's using a Proxy to catch every property access on an object, and it selects the most appropriate existing one based on its Levenshtein distance. then it overrides __proto__ of global.

should i use this?

no.

license

MIT

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago