Skip to content

Cribyte/ArraySQLJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArraySQLJS

Simple Array Administration Tool with Javascript Chain of Responsibility

1.Embed needed JS File(NodeJS or Client Side) in your project

1.1 NodeJS

     Import minsql.node.js in a directory (for example: function/minsql.node.js)
     Import by require and a variable (for example: [app.js] | var mj = require('./functions/minsql.node.js');

1.2 Client Side

     import minsql.min.js in your projects directory
     embed minsql.min.js in <script>
     (Should look like that: <script src="{PATHTOFILE}/minsql.min.js"></script>)

2.Have an JavaScript Array!

Its important that u own an array. ArraySQLJS only accepts arrays!

3. API

3.1 Structure

  Its simple. You just have to call the Object by _() or mj() and set behind a method.
  _(ARRAY_VAR).FUNCTION()
  mj(ARRAY_VAR).FUNCTION()
  
  Functions:
   public select(...params):any[]{}
   public selectConsole(...params):MinSQLJS {}
   public selectFor(doing:Function):MinSQLJS{}
   public delete(index:number, ...args):MinSQLJS {}
   public update(index:number, value:any):MinSQLJS {}
   public append(index:number, value:any):MinSQLJS {}
   public insert(...args):MinSQLJS {}
   public then(callback:Function){}
   public appendObject(index:number,obj:any[]):MinSQLJS {}
   public sort(sort:string = 'asc'):MinSQLJS {}
  
  For example:
     var my_array = ['Hello' , 'World'];
     _(my_array).selectConsole();
     __________________________________________
     Output: 
     Hello
     World

3.2 SELECT (Get Array Data)

     3.1.1 Get Array public select(...params):any[]
        _().select(); //Brings you all elements of the array
        mj().select(); //Brings you all elements of the array
        
        Example:
        _(my_array).select();
        
        Data:
        [Element1 , Element2]
        
        If your are working with an Array of objects and you like to filter properties. You might pass arguments.
        
        Example:
        var arr_of_obj = [ { name: 'Kris' , age: 19} , {name: 'Joe', age: 20} ];
        _(arr_of_obj).select();
        
        Data: 
        [{ Element1 , Element2} , { Element1, Element2}]
        Object
        
        Filtering Method Example:
        _(arr_of_obj).select('name');
        
        Data:
        [PropertyNameofObjectIndex0 , PropertyNameOfObjectIndex1]

Releases

No releases published

Packages

No packages published