How to use the fonteditor-core/common/lang.overwrite function in fonteditor-core

To help you get started, we’ve selected a few fonteditor-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
it('test null object', function () {
        let result = lang.overwrite(
            {
                x: 1
            },
            null
        );
        assert.equal(result.x, 1);

        result = lang.overwrite(
            {
                x: 1
            },
            undefined
        );
        assert.equal(result.x, 1);

        result = lang.overwrite(
            {
                x: 1
            },
            false
        );
        assert.equal(result.x, 1);
    });
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
it('test deep overwrite', function () {
        let result = lang.overwrite(
            {
                level1: {
                    x: 1
                }
            },
            {
                level1: {
                    y: 3
                }
            }
        );
        assert.equal(result.level1.y, 3);

        result = lang.overwrite(
            {
                level1: {
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
it('test fields', function () {
        let result = lang.overwrite(
            {
                x: 1
            },
            {
                x: 2
            },
            ['x']
        );
        assert.equal(result.x, 2);

        result = lang.overwrite(
            {
                x: 1
            },
            {
                x: 2
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
it('test null object', function () {
        let result = lang.overwrite(
            {
                x: 1
            },
            null
        );
        assert.equal(result.x, 1);

        result = lang.overwrite(
            {
                x: 1
            },
            undefined
        );
        assert.equal(result.x, 1);

        result = lang.overwrite(
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
it('test deep overwrite', function () {
        let result = lang.overwrite(
            {
                level1: {
                    x: 1
                }
            },
            {
                level1: {
                    y: 3
                }
            }
        );
        assert.equal(result.level1.y, 3);

        result = lang.overwrite(
            {
                level1: {
                    x: 1
                }
            },
            {
                level1: {
                    x: 2
                }
            }
        );
        assert.equal(result.level1.x, 2);

    });
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
it('test fields', function () {
        let result = lang.overwrite(
            {
                x: 1
            },
            {
                x: 2
            },
            ['x']
        );
        assert.equal(result.x, 2);

        result = lang.overwrite(
            {
                x: 1
            },
            {
                x: 2
            },
            ['y']
        );
        assert.equal(result.x, 1);

    });
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
{
                x: 1
            },
            null
        );
        assert.equal(result.x, 1);

        result = lang.overwrite(
            {
                x: 1
            },
            undefined
        );
        assert.equal(result.x, 1);

        result = lang.overwrite(
            {
                x: 1
            },
            false
        );
        assert.equal(result.x, 1);
    });
github kekee000 / fonteditor-core / test / spec / common / lang.spec.js View on Github external
assert.throws(function () {
            lang.overwrite(
                'abcde',
                {
                    0: 'f'
                }
            );
        });
    });