Neural Processing Mechanisms

    fill-object
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.2 • Public • Published

    fill-object

    Fill deep properties missing in an object based on a source

    Installation

    npm:

    npm install --save fill-object

    Yarn:

    yarn add fill-object

    Usage

    First, import the library:

    const fillObject = require('fill-object');

    Then you can use the imported function to infer the type of a string input:

    const defaultUser = {
        name: 'Unknown',
        age: 0,
        job: 'Unknown'
    };
    
    function fillUser(user = {}) {
        return fillObject(user, defaultUser);
    }
    
    const user = fillUser({ name: 'Giancarlo' });
    
    console.log(user); // { name: 'Giancarlo', age: 0, job: 'Unknown' }

    Tests

    If you want to test the library, you can run the tests by running the following commands on the root of the project:

    npm:

    npm install
    npm test

    Yarn:

    yarn
    yarn test

    Keywords

    none

    Install

    npm i fill-object

    DownloadsWeekly Downloads

    12

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    4.92 kB

    Total Files

    7

    Last publish

    Collaborators

    • giancarl021