Skip to content

Commit

Permalink
Add _.words implementation (#224)
Browse files Browse the repository at this point in the history
* Add _.words implementation

* Updating codesandbox references

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
102 and github-actions[bot] authored May 15, 2024
1 parent 2403496 commit 9740872
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/code-sandbox-refs.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,6 @@
"lodash/number/random": "https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKAdgVwLYCMYCcD0uAhigCYD2G-U5pRcAFgHQBWCyIAxuSgC4x8kIfPgAEDXrwAOcRCJp1GTblQqc4-AMTEylADooIGKeVy9RwUTooZRAX1FhclUQHIF9Bq4MGYADxMzOCYIPhgAczwABgBWUQBeKxIbAAoogBpRGIBKAxEEgD5RElFQ_kjcURxeAHcYAVEo4rIsnxR_QN5gsoi8OMTrShScvLF4oqIoOHJm0rCKqpha-pRG5tJWlF8A0y6mMBoiXlDw_qTdDGHM3lw0GFyUfPHix0PjlHCAWhMy0XRsPCLZYNJrJTbbTrBA7kI4nBLnVIARiYACZMjFUQ8nhNXjD3l8fnw_pgcJVqnUGsiUessqi2h1dt15oCBskhlixkUmqZRIj6Tsgkx2uFYQA3GDwwaXT6IjmFUQy0Q8qIGEDpEAQOAAIVCRFwAE8kGBJnAYHZ1f9SYQ2VQpUw4FIYJxWOxQNwwoJEFweHBzB5GJKYABHNAQXAwFKuJjUWieVwPd2-0RSKBEUKBkNhiNR_CikjQVPxtr8X2RqVpdHZVyZFLZeXAAyiUQdJ28FL-5g9CqxbJMXjkLUwADi4aOeAAKgwSAB5XAAURDkzSDybLc4bZTaZQIWZuB7fYHw9H_Fwk5n88XUGXjebAVb7djSi70RyB8HABl4HAzyhZwu0EuIyrLejrrikm6hDu5Qvr2_Yfl-P5_pewwriB94ANoZLymRoqIADMmQACzogAurB5AAMI8L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E2-OQX4lpARpJBDSLJEIYk4MkZcDGtIBalMSRU_EVSal0NCekqkjS6TZIFHsEJrILi1m6VyJUlQ-TjO8bXCU0zUihzmQqRECzGiqnVJqHUKA9SGkQMaKYHcQBMCkCY44eBcCcGHt6D048vQgL0CAU0GAIAfKQec006QbwfLgCcWAABFNA30YC_I6sUwFwEPl6mcDUAACnqAQcAYWItFNU0gHz4VNg-SGKFKLnAyCxSAG58A8Dig-UjVU5pKVEE4AAayIJEF0PAnnun4J6VARAMAwCEB2HuNhG6kBgI6AhKBOAQHgE8jsQhCJMERAAdlRIiRuAABLARAcBQEIPg44gqhDqsRBiQiIA7DWutUAA&query=previewwindow%3Dtests%26file%3D%2Fnumber%2Frandom%2Fvanilla.js",
"date-fns/01-interval/eachDayOfInterval": "https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKADARgLQQHYBcYBOAbgIZQD0MJAxgBYAiJAngPJgCSehpFAJifgxhscAHQArBMhDUA9lzxIQ5cgAJauXAAc4iFf0HCxsggHNyRAMyiArKJTles6nEo0GzNp3zEyAHWwIAFstE1xVYFUqOkZWDi5fKFUAX1UwAlkg1QByAxghEWyAgJgAD1CCXDFeGDASAFcocIBeKPdYrwSeAApgANVVOFwSSsRVbBgAd1VGfG6AJnQAFgAaVQBONYA2AEoV_qjsXjGJ6dmYBeW1zdU0FD2A5J2AlWaAPlUAbRe1AYBZeSqFjUcIoLaqRZoJaqFAoRCw-EofbYFQDVQAFXqMCBIJhAHYIcsYXCEbDkaiBgB1GC8HGggAchKhxMRiPJvwxtHqdJh6yZ0NJJKRPzRADECBAeXd-SzBSKALrFCblMJiIYwLRaGmqVrRDxxbzcMjdA59bBowbDUbjKYzAQXSGrDbbB7mtEwI4nW3nS5Q65rO6ugbJZEDSLqrRjSwpALPbA_d5fEVU7XA0Hgx2yoXstEA81p3kywVshUBEArEAQOAAIRwIyYSDqUDgMBDIHQWC6ZDcMU88R8PB7-s6A7IojgWuoEikoDkClwSjnQyi5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gMQ6OIA2xaBoAAaxIJrac8g8FzgBguaQ11PZKDyOpIcTl3o8HLCAGoWojgemoFgmcri1JGCUNYOwKAXEAAEABGJAwkwAoAQeoeAdZKDxKINAdglg6OSBk5IQA&query=previewwindow%3Dtests%26file%3D%2F01-interval%2FeachDayOfInterval%2Fvanilla.js",
"lodash/lang/cloneDeep": "https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKKBDAdgcwPQGMoD26MAIjDAA7aQAeAUgMokDyAsgKLoBuEATkQFsY6AC4A6AFYJkIXERHCRSENgBUAAghwRGAEYBXKJszoCvGOsix1q7AB10EARTMj1jFh259Biy_wF1AHIJeBEAWmEefnQhUXCpABMCASCHB2xsdQALEREKOERMzAgRbP1dMTkBalRcGF0CAgBrbFDtbF1CXWwuACYATjEAFjEAZmwAdwa4UphemF5ZohhEgH1k3DgFpYgicMGR7ABhIkhMfV5UET30MQFEgGIFbSifWMVw7V4ILAcYGguXhuRIwMCoQxufCoOBwdQAMQg9CYbE40V8onUAIU6EScI8qO8MTibmADnU6jk6G--lwIjMAAoxMzULxMHAAJTqMnoCkUuD6CiLJkstmc9K8vmZBEASQAGhwcnkCkVsCUyhUqik2nBkjUktqtAL4NgxmMAGxjcl8spaMSYbqoKBiGl0y6rY6EYjqAC86ldIndiU9K2tAF8HBH0CAADQgLQAIV-rIAnkhwVA4DAw3G0Fg8F7SOQqIREjDspJpKAqTilIgVFlcvlCplS-WtTVNttHvgVmRKA4nEDSZTC_2KOow_4UsE23Bsml0A4uKz1ARdKE6XC_QBtYDBVBBRDqACMk5j3OCuiP6j6k4AuhKV7x1KDKL7R33iwz15uROKl1iAhEkMGAxABYdt1fYsdwABnvX0fT9X8YC3ODH3QaUfQAPksJ0swcWN4zgJN0FTdN8OzXMMBwXtiHHAsv0oF0hVwSskGreRFGUNRVHJDQAAF2giN5iT8MRsDgXhcDwLjRGwOdsgUmjGPo4tqCRAkvHRD5RErfj7EAqltCxQFUIURIPwzAijKIEzFI_cwAEd9D4GAGSCCTFKCDkHGMtwKDQX5HJgFy3I8iSV0cKA0B8iUXhEDy6KLSgggvBkuRw7lrQg8yGUUjkxHpdgXKdBlcrpVZfMlCrEsC1BfkK4rSqgfLgPLaqw2qojE2TXg00QayqJAPNaLHdSougNB2JkGtuPrfzPzU99kI3czfVwgMgxDYgfzWulquXVcUK3D89wPG8zxzS8gmvY87zDDCjpfN8Jz9ZLxz2v8AIcARgNA8DAVcKDXvQxDVu-9CMiyLKhsIuNerI_qKMzYaxAocw8ggRZpI42Q5LrEAeQpOwQCzAQIFJ48hpja1SdmLBYAARX0AgFCp9QRF4fQYFpyVSdZfhJgABVZYQ4A5gWuAICBElJvmSZAFy2ZgYX-AKSWQAx-BFi4GBScjQicy1upmlQTAwKkIg8bm0Q8bIoRlEU1SUooIjQSFXFhFwbGqxG9r52UUYTwAdjEPoTyIgTdFQXQYCgbBudEJwYGUMOTwAVhGEAw1z3OgA&query=previewwindow%3Dtests%26file%3D%2Flang%2FcloneDeep%2Fvanilla.js",
"lodash/lang/isEmpty": "https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKKBDAdgcwPQTgUQFsAHAFwE9soB7AE1TgAsA6AKwWRAGNr1SY-SENmwACRqVLE4iETXpNmPQtlrUucbAGI8RMuQA66CCWoAnUqOCjdJCqIC-osGeqFRAcnkNGHo0ZgAD2JzUjhmdABXKChRAF4bAjtyAAoomIBKIxF4gD5RUjNImH90IJCLcIAjampYDHjEvQoUwuKs9By4_LaS9ADg0PCowiqYM0bbfRSARg6unqK-gYqw5jhCiCxJpOmPdGpLGGSPebFu51QoOGWywcr1mEsEqZaygHdRAGUnlIBtGYAGlEACZgQBmAC6GTOeQKS1K5SGzEIqGIO2aqQ-ogAsmj_n8PKgPMCZpDobCLmArjdEfc1qgzGZUOQMcl_kDQRDodlzvlqddbkiHtQqqwYFxnk12dYiR5EKIZo5KfyaUL6eFjvoAIJMlls6Z_HmdPnw4p01aa5JfTbbF67FoeU68uG9C3IrUUH5S15YmCfb0pGEui5u_p3S3MT3kPHo-2YtL-3H44Mm10I9AgQEgPAAIS2jPISAFNwc2bQWFwDsovvWxAlbA4oB4fAEpCELY2onKEv4tEawCMolEjOZ5AVJZggKH3eSurHCt60_Qw-jscXS2Xq-tTw3xS3s_0NrMW0we6nM9RxAnaoP6Sg57vkVG40fM9F4slN8FB5qdRgGBviuog3KQ343AeGwnlg4EXugDilJ2ljeEwjRmDAACOkQQOhKQeMwVB0D4zroEhojEGgWxoZh2G4fh2AAG4YNAaAkUY_AbHhvokqIQZwoOwE9pKKQoYwGTMKQ1D4FhVwpEJfYdKuwS9ikFGoFs4mSdJkSyaJHQOB0WY5nA-boIWxZqmWIAVjgvqMcxMSoI2SDNrw_CCIg3C8F2vqNB-eQzgAhAA8mKvZRnwJ7wCk_kAD6xVYBnMLAWCkIwogAGQZaIgUfgA_MlAiYGlmXZblYoFXAEAAF7qpG94Gm80RQCqZp1cif71Cu8bsr0rVhisyIjGMEw9dMcwhos5rhsKaxQaejWpPshyHhQJELJcgrug8oGLYmAa_ACwJgqIUKphtk7bWsV57disYEnKpLkudpqXTNGrMKO-pjS0R1cqdxoXWqV3hB-vZ7bKxIKkqBmTZttLvZG0bzt90qGoDpoDRGHrWramB7U6_UZoNDzRt6t1JoGL3ptNJNrGuaIU5893U6GGZGXmBZmEWiCTlZzDEOhkgQOMZhcC5Xmth5IACcOBggDchAQPLsEHvLVVYLAACKkSHCUSBtWrICjtQ7wAAqMgIcAq6I8uoAx1AQLQ8tG1hetm640g2_LgvwOMDH60YCGZlZxCoFwADWqCYDAja8BLLbue2nBmYQMBCKJVaYkZtAwPW6C56RItNtZRFMEIAAszAzAA7MwIIzEZAACVSoGMUDYEUfAmOnnl1zMACszAVyADhj2PQA&query=previewwindow%3Dtests%26file%3D%2Flang%2FisEmpty%2Fvanilla.js"
"lodash/lang/isEmpty": "https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKKBDAdgcwPQTgU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xoXWqV3hB-vZ7bKxIKkqBmTZttLvZG0bzt90qGoDpoDRGHrWramB7U6_UZoNDzRt6t1JoGL3ptNJNrGuaIU5893U6GGZGXmBZmEWiCTlZzDEOhkgQOMZhcC5Xmth5IACcOBggDchAQPLsEHvLVVYLAACKkSHCUSBtWrICjtQ7wAAqMgIcAq6I8uoAx1AQLQ8tG1hetm640g2_LgvwOMDH60YCGZlZxCoFwADWqCYDAja8BLLbue2nBmYQMBCKJVaYkZtAwPW6C56RItNtZRFMEIAAszAzAA7MwIIzEZAACVSoGMUDYEUfAmOnnl1zMACszAVyADhj2PQA&query=previewwindow%3Dtests%26file%3D%2Flang%2FisEmpty%2Fvanilla.js",
"lodash/string/words": "https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKOAXAThAdgcwPQDuA9ugCZx5RGkCGcAFgHQBWCyIAxkVqjD0iDx4ABPVSoADnERCqtBoy4BbPKSIcKAYmJk4AHSwQlEkqmHBhO8sIC-wsOiJLhAcjl16LgwZgAPE-iocIx8AK5KMOg0qBDcwgC8liTkABQuDjCkADTCAEY06FgwAJ45AGTCEjC5ubBwLgCUBkIJAHzCANrp6JkuOS75hSV9rlU1dS4AugYgWSAQcABC2AXFSGA0UHAwNnNomLiEyRRWwXBVHCxsoFw8fKgCt2jCfhe8pAnmBsIvWOGR0ViWEQnW6vX6gyKxRGLjGtXgUyyBhs3iwTzM7gYnx6AEdQhAemlGJRqB5GgZ0ZUoDRsNiYHiCTAiXgAG40QxQankrAGXhoNKnEYpBptL5YH6vGAcVApTH0BqMVBEACieM2KUl0syTXFL38UplEmp2AVStVoXVcp1Nh1s3mSxW6DWiA2Wx2eww2Hwp1Z7Og1KuSBu3F4_EQnG4z1On32ouA32ElO2OAid3QnyKBGEAEkeFBGABlGAp-6RNJ8EYWHBRP7UzCoYoglxWFy2HU_HqoUKFYQAQXQUWKjAcThSydTvHQjHH9zHGAa7Z-wmH0EnKRSFgWAHVkgAZCAAaxgbdF273h5gi5-jCUNAk64sM54J_i7SfqGtqNepmCYQiURiOJElONIMmyPICihcpKmqeF6h1FpX1BMCYUhYZ-jhCZpiwO0FmWLBVnWTZtl2EBGAkTsYkidAOCDCM7jDEB411PQQG2JQIFYkFXW2JEWLYr1YAARVCIheC44QMFCGA-J-ViCkcAgAAUCj4fQkGEeSWSICBSFY2TNJAPExJgJTHCkCTWIo-BIhZGBWORGZSIkGgOAPGgcBgK5uDo25QwedgCIiAQ5SOXQ7VIGAqiwSK0QgeA6LlAQABZGAARgAdkYAAmNK7QAAXyXIYCgPB0FCHgjBgAQsrSgBWRhkpAGwWpaoA&query=previewwindow%3Dtests%26file%3D%2Fstring%2Fwords%2Fvanilla.js"
}
3 changes: 2 additions & 1 deletion src/code-sandbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,6 @@
"lodash/number/random": "https://codesandbox.io/s/1m9u5r?previewwindow=tests&file=/number/random/vanilla.js",
"date-fns/01-interval/eachDayOfInterval": "https://codesandbox.io/s/gv4w2v?previewwindow=tests&file=/01-interval/eachDayOfInterval/vanilla.js",
"lodash/lang/cloneDeep": "https://codesandbox.io/s/j5mnp4?previewwindow=tests&file=/lang/cloneDeep/vanilla.js",
"lodash/lang/isEmpty": "https://codesandbox.io/s/8yv474?previewwindow=tests&file=/lang/isEmpty/vanilla.js"
"lodash/lang/isEmpty": "https://codesandbox.io/s/8yv474?previewwindow=tests&file=/lang/isEmpty/vanilla.js",
"lodash/string/words": "https://codesandbox.io/s/ftt9qy?previewwindow=tests&file=/string/words/vanilla.js"
}
3 changes: 1 addition & 2 deletions src/content/lodash-missing.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@
[\_.template](https://lodash.com/docs/#template)
[\_.truncate](https://lodash.com/docs/#truncate)
[\_.unescape](https://lodash.com/docs/#unescape)
[\_.upperCase](https://lodash.com/docs/#upperCase)
[\_.words](https://lodash.com/docs/#words)
[\_.upperCase](https://lodash.com/docs/#upperCase)

### Util

Expand Down
5 changes: 5 additions & 0 deletions src/content/lodash/string/words/lodash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// https://lodash.com/docs/#words
import { words } from 'lodash'

exports.enumeration = words('fred, barney, & pebbles')
// => ['fred', 'barney', 'pebbles']
3 changes: 3 additions & 0 deletions src/content/lodash/string/words/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Splits <code>string</code> into an array of its words.

Resources: [Intl.Segmenter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)
11 changes: 11 additions & 0 deletions src/content/lodash/string/words/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const expected = {
enumeration: ['fred', 'barney', 'pebbles'],
}

const lodash = require('./lodash')
const plain = require('./vanilla')

test('words', () => {
expect(lodash).toEqual(expected)
expect(plain).toEqual(lodash)
})
9 changes: 9 additions & 0 deletions src/content/lodash/string/words/vanilla.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const words = str => {
const segmenter = new Intl.Segmenter('en', { granularity: 'word' })
return Array.from(segmenter.segment(str))
.filter(({ isWordLike }) => isWordLike)
.map(({ segment }) => segment)
}

exports.enumeration = words('fred, barney, & pebbles')
// => ['fred', 'barney', 'pebbles']

0 comments on commit 9740872

Please sign in to comment.