Create Element In First

you can create element in first of array via file.createElm function

const json = require("jsonbyte");


const file = new json("./file.json")
/*
{
 "username": "body",
 "ranks": [
  "owner",
  "member",
  "first",
  "pro"
 ] 
}
*/

file.join("ranks").createElmInFirst("good").leave().save();

/*
{
 "username": "body",
 "ranks": [
  "good",
  "owner",
  "member",
  "first",
  "pro"
 ] 
}
*/

Last updated