Repository
Current version released
4 months ago
Versions
JFather
Boys use JSON; Men use JFather.
Overview
JFather is JSON with features to merge, extend and override JSON objects.
import JFather from "jfather";
const merged = JFather.merge(
{ foo: "a", bar: "alpha" },
{ foo: "b", baz: "beta" },
);
console.log(merged);
// { foo: "b", bar: "alpha", baz: "beta" }
Install
Node.js
JFather is published on npm.
import JFather from "jfather";
Deno
The library is available in Deno.
import JFather from "https://deno.land/x/jfather/mod.js";
Browsers
It can also be accessed directly from the CDN esm.sh (ou jsDelivr, UNPKG) :
import JFather from "https://esm.sh/jfather@0";
// import JFather from "https://cdn.jsdelivr.net/npm/jfather@0";
// import JFather from "https://unpkg.com/jfather@0";
API
merge()
Merge two variables.
a |
b |
JFather.merge(a, b) |
---|---|---|
1 |
2 |
2 |
{ foo: "alpha", bar: "ALPHA" } |
{ foo: "beta", baz: "BETA" } |
{ foo: "beta", bar: "ALPHA", baz: "BETA" } |
{ foo: [1, 10, 11] } |
{ foo: [2, 20, 22] } |
{ foo: [2, 20, 22] } |
load()
Load an object from an URL.
parse()
Parse a string.