- Version: 1.0.0
- License: MIT
- Author: Jahongir Sobirov
- Download the Data.js framework from github in .zip format.
- Place the bin folder in the application folder you are creating.
- Copy and paste
bin \ data.js
into the require function in your program code. - Start
|___app.js
|___bin
|__data.js
|__test.js
const Data = require(".bin/data")
var app = new Data(["data.js","php",14],{
get: 0,
getLenght: false,
join: false,
copy: 1,
constructor: true,
entries: false,
reverse: false,
sort: true,
fill: false,
shift: false,
map: false,
pop: false
});
You must write a list of all methods in this framework in order. You must write a value of false
to the method you do not want to use (otherwise true
or some value).
With this framework, you can easily work in arrays.
- Download
.zip
file Data.js in Github - Create new folder for your new app
- Copy bin folder in Data.js:
|___bin
|__data.js
|__test.js
- Importing Data.js your file:
const Data = require("./bin/data.js"); // importing data.js
var app = new Data();
This framework syntax very simple
const Data = require("./data"); // importing data.js
var app = new Data(["data.js","javascript",14,25,9,16], // the main array that the framework takes
{
get: 0, // returns the desired value from the array
getLength: true, // returns length of array
join: ", ", // places the desired value between array values
copy: 1, // copies any value in the array
constructor: true, // returns the data type
entries: true, // returns the data type
reverse: true, // displays the values in reverse order.
sort: true, // sorts the values in alphabetical order
fill: "data.js", // replaces the array values with the value in this method
shift: true, // assigns the first value
map: Math.sqrt, // delete array values
pop: true // returns the final value
});
To use this framework, upload it to your new file
const Data = require("./data") // importing
Since the method name is not given in Data.js, you name it with the name of the imported variable
var app = new Data([12,13,"Hello, world"],{
});
The get:
method will help you to do this.
var app = new Data([12,13,"Hello, world"],{
get: 3
});
This is done using the getLength:
method.
var app = new Data([12,13,"Hello, world"],{
getLength: true
});
For example, if you want to add a comma between array values, please:
var app = new Data(["Hello world",12,16,18],{
join: ", "
});
It's very easy:
var app = new Data(["Hello world",12,16,18],{
copy: 0
});
Try:
var app = new Data(["Hello world",12,16,18],{
constructor: true,
/*
or
*/
entries: true
});
You reverse the array values using the reverse:
method.
var app = new Data(["Hello world",12,16,18],{
reverse: true
});
To do this, you need the sort:
method.
var app = new Data(["D","B","A","C"],{
sort: true
});
To do this, you need the fill:
method.
var app = new Data(["D","B","A","C"],{
fill: "data.js"
});
Try:
var app = new Data(["D","B","A","C"],{
shift: true
});
All rights reserved (c) 2021