01 2020 档案
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num
阅读全文
摘要:Yarn 2 is workspace aware. When you need to upgrade a package in one workspace, yarn will ask you if you want to resolve the version of the package to
阅读全文
摘要:yarn dlx can be used to run packages without installing them. This is useful for packages like create-react-app and gatsby that scaffold out apps for
阅读全文
摘要:This lesson goes over how to install yarn 2 through npm. To install yarn 2 globally, we use npm install -g yarn@berry Init a project: yarn init -y To
阅读全文
摘要:1 . Create a directory for global packages mkdir "${HOME}/.npm-packages" 2. Tell npm where to store globally installed packages npm config set prefix
阅读全文
摘要:// eslint exercise 4 (no-console) // When you're finished with this exercise, run // "npm start exercise.eslint.5" // to move on to the next exercise
阅读全文
摘要:function looksLike(a, b) { return ( a && b && Object.keys(b).every(bKey => { const bVal = b[bKey] const aVal = a[bKey] if (typeof bVal 'function') { r
阅读全文
摘要:// eslint exercise 1 (no-console) // When you're finished with this exercise, run // "npm start exercise.eslint.2" // to move on to the next exercise
阅读全文
摘要:Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true /** * Defi
阅读全文
摘要:Trying to structure the state logic of an application as a single machine can begin to become unwieldy when we have too many states. It is often bette
阅读全文
摘要:We can invoke a callback as a service when we enter a state in XState. This gives us the ability to trigger various functionality by responding to eve
阅读全文
摘要:Unbeknownst to many, promises are state machines. They exist in either an idle, pending, resolved or rejected state. Because they can be modeled as st
阅读全文
只有注册用户登录后才能阅读该文。
摘要:The passing of time can be represented as an event in XState. Rather than requiring the user to send an event after an amount of time has passed, XSta
阅读全文
只有注册用户登录后才能阅读该文。
摘要:drcorator should be named as '<directive_name>Directive':
阅读全文
只有注册用户登录后才能阅读该文。
摘要:Can you walk and talk at the same time? If so, you've experienced what it's like to be in two states at the same time. Hopefully, those two states hav
阅读全文
摘要:As our state machines grow more complex, we might find ourselves in a situation where a state should only exist if the machine is already in another s
阅读全文
摘要:Not all transitions should be taken immediately. Occasionally, we would like to conditionally take a transition. We do this through the use of "guards
阅读全文
摘要:Activities are continuous, ongoing side effects that are triggered by entering a particular state, and only stop when that state is exited. In the exa
阅读全文
摘要:Consider a text input. It would be impossible for anyone to model every value you could possibly put into it, because the number of possible values is
阅读全文
摘要:XState provides the send function to create an action that will send the event passed in to the machine. If we provide the second argument to the send
阅读全文
摘要:Transitions come in two varieties: "external" and "internal". By default, a transition is considered external. This means that a transition will exit
阅读全文
摘要:For example, we have a interface: We are using it with NestJS backend, in order to validate the request with meanful runtime error message, we can use
阅读全文
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
摘要:While it's powerful enough to have Machine.transition, it can get tedious constantly passing it a state and an event. It would be nice if we had a fun
阅读全文
摘要:numerating the possible states of a function is a sound way to write a function, but it is imperative and could benefit from abstraction. We can do th
阅读全文
摘要:There are several fundamental problems with trying to manage the state of a function through the use of booleans. The first is often referred to as "b
阅读全文
摘要:Fire and Forgot: Fire an action and not wait it complete. Fire and Wait: FIre an action and wait for result. Fire and Forgot Fire and Wait: Using `mer
阅读全文
摘要:Problem: Two ways to solve the problem: 1. Change the order: 2. Using createSelector:
阅读全文
摘要:When defining a selector, you can also pass other selectors into the signature of the Selector decorator to join other selectors with this state selec
阅读全文
摘要:1. Selet piece of state from Store: This is useful when you just want to get state from the store directly. Of course that global state should contain
阅读全文
摘要:This approach can also allow for the creation of well named helper functions that can be shared between handlers that require the same type of update.
阅读全文
摘要:In general, it is not recommeded to use Namespace in Typescript, we should use ES6 module export import syntax. But there are still some good usecases
阅读全文
只有注册用户登录后才能阅读该文。
摘要:Fallback exception filter is mean to catch any exception which are not catched by other exception filters; main.ts: Order matters, from most generic t
阅读全文
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
摘要:We make a .env file and accidentally push it to github. In order to remove the .env file, we first have to add it to our .gitignore file - but that's
阅读全文
摘要:We've made a pull request and now we can clean up the branches by deleting the feature branch. Branches are just pointers to commits - so we can safel
阅读全文
摘要:Throw expection from Controller: Expection types: https://docs.nestjs.com/exception-filters#built-in-http-exceptions We can create global reuseable ex
阅读全文
只有注册用户登录后才能阅读该文。
摘要:main.ts Module: Schema: Controller: Repository:
阅读全文
只有注册用户登录后才能阅读该文。
摘要:Real forms are rarely visualized as a single column with one field below the other. Rather they often span over multiple columns to save screen space.
阅读全文
摘要:Assume we want to add a data-cy attribute to all of our form controls. We need this as a hook to later be able to easily grab our input fields from wi
阅读全文
摘要:In a real form you'll most likely want to add some 3rd party form controls. For example autocomplete fields, date-time pickers etc. In this lesson we'
阅读全文
摘要:Formly comes with a lot of built-in validators. Nevertheless you most likely will have to to implement some custom validation. In this lesson we're go
阅读全文
摘要:When you display error messages you want to make them as understandable as possible such that the user is able to figure out the problem. Example: the
阅读全文
摘要:In this lesson we're going to learn how to dynamically hide a form control with Formly's hideExpressions. These expressions are evaluated automaticall
阅读全文
摘要:Formly has a nice mechanism called "expression properties". These are expressions in the form of a function callback or string expression that are eva
阅读全文
摘要:Ever had to disable a form control based on the value of another form control? If your city dropdown field is filtered based on the current nation dro
阅读全文
摘要:Every serious form in large apps has some dependent fields. For instance a dropdown field containing all nations and another dropdown field displaying
阅读全文
摘要:Once a commit is pushed, you do NOT want to use git reset to undo it - because reset will rewrite the history tree, and anyone who has already pulled
阅读全文
只有注册用户登录后才能阅读该文。
摘要:If you've removed a commit with git reset --hard, it's still possible to recover the commit using git reflog to look up the commit hash. Once we find
阅读全文
摘要:git reset has three primary options that we might use: --soft, --hard and --mixed (the default). We'll use git reset to undo the latest commit in all
阅读全文
摘要:Generators offer flexible alternatives to working with arrays and how you want to iterate through the data. While most scenarios are covered by the me
阅读全文
摘要:Generator functions are great at generating data. You can create all types of functions that take params to define what sort of data to generate. The
阅读全文
摘要:Since generators can take initial values and expose a next method which can run updates on the initial value, it becomes trivial to make a state machi
阅读全文
摘要:Generators emulate the behavior of a closure where they wrap an initial value then can take subsequent values through next to yield something based on
阅读全文
摘要:Generators allow you to hook together multiple generators with the yield* syntax. This allows you to branch off into many different types of iteration
阅读全文