FLIP animation applied on CSS grids with the help of MutationObserver that activates when the grid or one of its children adds or loses a class or element.
Get it:npm install animate-css-grid
Sample usage:
12345678910111213
import{wrapGrid}fromanimateCSSGridconstgrid=document.querySelector(".grid");constconfig={// int: default is 0 msstagger:100,// int: default is 250 msduration:500// string: default is 'easeInOut'easing:'backInOut'};wrapGrid(grid,config);
12345678910
<!-- grid style applied via a class --><ulclass="some-grid-class-that-changes"><!-- each grid item has a single direct child --><liclass="grid-item"><div><h3>Item title</h3><div>Item body</div></div></li><div>
Progress bar and estimation for Promise compilation.
progress-estimator logs a progress bar and estimation for how long a Promise will take to complete.
It tracks previous durations in order to provide more accurate estimates over time!
Get it:npm install progress-estimator
Sample usage:
123456789101112131415161718
constcreateLogger=require('progress-estimator');// All configuration keys are optional, but it's recommended to specify a storage location.// Learn more about configuration options below.constlogger=createLogger({storagePath:join(__dirname,'.progress-estimator'),});asyncfunctionrun(){awaitlogger(promiseOne,"This is a promise");awaitlogger(promiseTwo,"This is another promise. I think it will take about 1 second",{estimate:1000});}
query-state is a cheeky module that uses history API and encodeURIComponent magic to maintain the application state in the query string.
Get it:npm install query-state
Sample usage:
12345678910111213141516171819202122232425262728
constqueryState=require('query-state');// create a new query state instanceconstqs=queryState();// get current application state from the hash string:constappState=qs.get();// you can also monitor for changes in the query string:qs.onChange(function(appState){// prints new application state on each hash updateconsole.log('app state changed!',appState);});// If you want to set a new value in the app state:qs.set('answer',42);// Now the query string will have `answer=42` part in it.console.log(window.location.hash.indexOf('answer=42'))// prints value > 0.// You can also set multiple values at once:qs.set({name:'Haddaway',song:'What is love?'});// NOTE: The call above merges new properties. It appends two new properties to // the current query string
Find out which food ingredients are vegan / non-vegan.
If you are vegan you would understand the challenge of staying a vegan, this module helps you to find out which food ingredients are vegan / non-vegan. It can answer that on 1 ingredient or on a list of ingredients. It uses a 850+ entries list of non-vegan ingredients.
It basically had parsed the information from the below sites into a JSON file.
veganpeace
peta
veganwolf
P.S: I can be cool to use this as a API and build an app, that would scan the ingeratients and let one know if it's vegan or not!
Get it:npm install is-vegan
Sample usage:
1234567891011121314151617
constisVegan=require('is-vegan');// example for single ingredientisVegan.isVeganIngredient('soy');// trueisVegan.isVeganIngredient('milk');// false// example for list of ingredientsisVegan.isVeganIngredientList(['aspic','albumin']);// falseisVegan.isVeganIngredientList(['soy','cacao butter']);// true// example for list of ingredients wich contain flagged and non-vegan ingredientsisVegan.checkIngredients(['soy','cacao butter','pork','glycine']);// returns// {// nonvegan: ['pork', 'beef'],// flagged: ['glycine']// }
🐴 said: Ever find yourself needing more details about Node.js errors? Me too, so node-errno contains the errno mappings direct from libuv so you can use them in your code.
varerrno=require('errno')functionerrmsg(err){varstr='Error: '// if it's a libuv error then get the description from errnoif(errno.errno[err.errno])str+=errno.errno[err.errno].descriptionelsestr+=err.message// if it's a `fs` error then it'll have a 'path' propertyif(err.path)str+=' ['+err.path+']'returnstr}varfs=require('fs')fs.readFile('thisisnotarealfile.txt',function(err,data){if(err)console.log(errmsg(err))})
Use as a command line tool:
1234567891011121314
~$errno53{"errno":53,"code":"ENOTEMPTY","description":"directory not empty"}~$errnoEROFS{"errno":56,"code":"EROFS","description":"read-only file system"}~$errnofooNosucherrno/code:"foo"