Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove underscore and replace with Lodash #165

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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