Closed meodai closed 6 years ago
PS: Autodoc is pretty cool
demo.js
=>
const nc = require('.');
let n = nc.from({
aqua: '#0ff',
black: '#000',
blue: '#00f',
fuchsia: '#f0f',
gray: '#808080',
green: '#008000',
lime: '#0f0',
maroon: '#800000',
navy: '#000080',
olive: '#808000',
orange: '#ffa500',
purple: '#800080',
red: '#f00',
silver: '#c0c0c0',
teal: '#008080',
white: '#fff',
yellow: '#ff0'
}, true);
console.log(
n('#f00'), // => red
n('#f00') // => teal
)
@dtao any thoughts on this? I kinda need this feature.
@dtao ok I needed this so I implemented it myself: https://github.com/meodai/ClosestVector
I had some time this weekend to read and understand your code. I figured I make a proposal for #3. Made me think that we could do caching in the same fashion. Meaning when the stringified needle is already in a "needleCache" object.