kittygiraudel / crud.js Goto Github PK
View Code? Open in Web Editor NEWA CRUD JavaScript class.
License: The Unlicense
A CRUD JavaScript class.
License: The Unlicense
Hello,
In CRUD.js, line 96:
collection = collection.length === 1 ? [collection] : collection;
I guess your intent was to support the case where select() is called with an ID instead of an array of ID. However, the code above does not achieve this and leads to a 2-level array when collection is an array containing only one ID.
The code does not break because in StorageDrive.js, line 21, getItem() casts the ID to a string, so key
(a 1-item array) becomes a string again (thanks to Array.toString()):
return JSON.parse(this.conf.storage.getItem(this.conf.name + ':' + key));
Cordially,
Mikael
here https://github.com/HugoGiraudel/CRUD.js/blob/master/src/CRUD.js#L275-L285, we can see nested block, prefer early return
, continue
or break
to make code simpler to read.
When I try to use the lib I only get a Uncaught ReferenceError: Database is not defined
.
Here's a pen to illustrate where I've inlined your script and then added the example from the README. http://codepen.io/davidpaulsson/pen/KdJJGQ
if you want to use modular JavaScript, use browserify and compile with grunt, but don't expose this method. https://github.com/HugoGiraudel/CRUD.js/blob/master/src/helper.js#L4
there are no tests, might be good to have some.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.