0.1.1 • Published 6 years ago

@martin-pettersson/wp-get-file-data v0.1.1

Weekly downloads
3
License
GPL-2.0
Repository
github
Last release
6 years ago

wp-get-file-data

A port of the get_file_data method from WordPress used to extract parameters from header comment.

Usage

It's simple! Just require the module and use the provided methods.

var wpGetFileData = require('@martin-pettersson/wp-get-file-data');

// get the fields asynchronously
wpGetFileData.getFileData('some/file.php', function(err, fileData) {
    if (err) {
        // handle error
    }

    // ...
});

// get the fields synchronously
var fileData = wpGetFileData.getFileDataSync('some/file.css');

// ...

// fileData is an object containing the keys and trimmed values from the file header