Skip to content

Commit

Permalink
remove dep
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Apr 2, 2018
1 parent da329cd commit cd98d0f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/to-file.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const typeOf = require('kind-of');
const define = require('define-property');
const stringify = require('./stringify');
const utils = require('./utils');

Expand All @@ -26,10 +25,10 @@ module.exports = function(file) {
}

// set non-enumerable properties on the file object
define(file, 'orig', utils.toBuffer(file.content));
define(file, 'language', file.language || '');
define(file, 'matter', file.matter || '');
define(file, 'stringify', function(data, options) {
utils.define(file, 'orig', utils.toBuffer(file.content));
utils.define(file, 'language', file.language || '');
utils.define(file, 'matter', file.matter || '');
utils.define(file, 'stringify', function(data, options) {
if (options && options.language) {
file.language = options.language;
}
Expand Down
9 changes: 9 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
const stripBom = require('strip-bom-string');
const typeOf = require('kind-of');

exports.define = function(obj, key, val) {
Reflect.defineProperty(obj, key, {
enumerable: false,
configurable: true,
writable: true,
value: val
});
};

/**
* Returns true if `val` is a buffer
*/
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"test": "mocha"
},
"dependencies": {
"define-property": "^2.0.2",
"js-yaml": "^3.11.0",
"kind-of": "^6.0.2",
"section-matter": "^1.0.0",
Expand Down

0 comments on commit cd98d0f

Please sign in to comment.