Skip to content

Commit

Permalink
Remove underscore and replace with Lodash
Browse files Browse the repository at this point in the history
Fixes #138
  • Loading branch information
KyleAMathews committed Mar 1, 2016
1 parent fb260b6 commit 486bd29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/loaders/markdown-loader/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import frontMatter from 'front-matter'
import markdownIt from 'markdown-it'
import hljs from 'highlight.js'
import _ from 'underscore'
import objectAssign from 'object-assign'

const highlight = (str, lang) => {
if ((lang !== null) && hljs.getLanguage(lang)) {
Expand Down Expand Up @@ -31,7 +31,7 @@ module.exports = function (content) {
this.cacheable()
const meta = frontMatter(content)
body = md.render(meta.body)
const result = _.extend({}, meta.attributes, {
const result = objectAssign({}, meta.attributes, {
body,
})
this.value = result
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ReactDOMServer from 'react-dom/server'
import webpack from 'webpack'
import Negotiator from 'negotiator'
import parsePath from 'parse-filepath'
import _ from 'underscore'
import find from 'lodash/find'
import webpackRequire from 'webpack-require'
import fs from 'fs'
import toml from 'toml'
Expand Down Expand Up @@ -102,7 +102,7 @@ module.exports = (program) => {
} else {
// Rewrite path to match disk path.
const parsed = parsePath(request.path)
const page = _.find(pages, (p) => p.path === (`${parsed.dirname}/`))
const page = find(pages, (p) => p.path === (`${parsed.dirname}/`))

if (page) {
request.setUrl(`/${parsePath(page.requirePath).dirname}/${parsed.basename}`)
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/glob-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import slash from 'slash'
import fs from 'fs'
import frontMatter from 'front-matter'
import htmlFrontMatter from 'html-frontmatter'
import _ from 'underscore'
import objectAssign from 'object-assign'
const debug = require('debug')('gatsby:glob')

module.exports = (directory, callback) => {
Expand Down Expand Up @@ -39,11 +39,11 @@ module.exports = (directory, callback) => {
let data
if (ext === 'md') {
const rawData = frontMatter(fs.readFileSync(page, 'utf-8'))
data = _.extend({}, rawData.attributes)
data = objectAssign({}, rawData.attributes)
pageData.data = data
} else if (ext === 'html') {
const html = fs.readFileSync(page, 'utf-8')
data = _.extend({}, htmlFrontMatter(html), { body: html })
data = objectAssign({}, htmlFrontMatter(html), { body: html })
pageData.data = data
} else {
data = {}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"toml": "^2.2.2",
"toml-loader": "^1.0.0",
"typography": "^0.7.0",
"underscore": "^1.8.3",
"underscore.string": "^3.2.3",
"webpack": "^1.12.13",
"webpack-configurator": "^0.3.0",
Expand Down

0 comments on commit 486bd29

Please sign in to comment.