Socket
Socket
Sign inDemoInstall

mw-dict

Package Overview
Dependencies
5
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

__mocks__/TEST_ETYMOLOGY.xml

15

__tests__/index.test.js

@@ -13,2 +13,3 @@ const url = require('url')

'pronunciation',
'etymology',
'definition'

@@ -82,3 +83,3 @@ ])

describe('pronunciation', () => {
it('return sound url', () => {
it('returns sound url', () => {
return dict.lookup('TEST_SOUND').then(results => {

@@ -89,3 +90,3 @@ let { pronunciation } = results[0]

})
it('extract correct subdirectory for sound url', () => {
it('extracts correct subdirectory for sound url', () => {
return dict.lookup('TEST_SOUND').then(results => {

@@ -100,1 +101,11 @@ let { pronunciation } = results[0]

})
describe('etymology', () => {
it ('returns etymology', () => {
return dict.lookup('TEST_ETYMOLOGY').then(results => {
let { etymology } = results[0]
expect(etymology).toContain('Yiddish [beygl,] from Middle High German [*böugel] ring')
expect(etymology).not.toContain('bow')
})
})
})

@@ -238,2 +238,27 @@ const axios = require('axios')

function etWalker(etNode) {
if (!etNode) {
return ''
}
let etymology = ''
let children = etNode.childNodes
let node = children[0]
while (node) {
switch (node.tagName) {
case undefined: {
etymology += ` ${node.textContent.trim()}`
break
}
case 'it': {
etymology += ` [${node.textContent.trim()}]`
break
}
default:
break
}
node = node.nextSibling
}
return etymology.trim()
}
function lookupPopularity(word) {

@@ -291,2 +316,3 @@ let url = `${POPULARITY_URL}?word=${word}`

pronunciation: soundWalker(entry.getElementsByTagName('sound')[0]),
etymology: etWalker(entry.getElementsByTagName('et')[0]),
definition: defWalker(entry.getElementsByTagName('def')[0])

@@ -293,0 +319,0 @@ }

2

package.json
{
"name": "mw-dict",
"version": "2.1.0",
"version": "2.2.0",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -46,3 +46,4 @@ # mw-dict

pronunciation: String[],
definition: Sense[]
definition: Sense[],
popularity: String
}

@@ -49,0 +50,0 @@ // Sense

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc